Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!wuarchive!rex!samsung!sdd.hp.com!decwrl!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: sort Message-ID: <9337@jpl-devvax.JPL.NASA.GOV> Date: 30 Aug 90 00:24:44 GMT References: <1990Aug21.224327.20194@iwarp.intel.com> <1990Aug22.111018.3329@comp.vuw.ac.nz> <105536@convex.convex.com> <1990Aug29.191454.23527@iwarp.intel.com> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 16 In article <1990Aug29.191454.23527@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: : In article <105536@convex.convex.com>, tchrist@convex (Tom Christiansen) writes: : | Is this simple enough for the sort function? : | : | sub bynum { substr($a,$[+1,10) > substr($b,$[+1,10); } : : Nope nope nope. I made that same mistake once. Think about : what this returns... either "1" or "0", not "1" or "-1". Arrrgh. :-) : : You want something like I already posted involving a test and a 1 or : -1 return. I just had the weirdest thought. The ne and != operators should maybe return -1 or +1 when the operands aren't equal. Larry