Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: sort Message-ID: <1990Aug29.191454.23527@iwarp.intel.com> Date: 29 Aug 90 19:14:54 GMT References: <1990Aug21.224327.20194@iwarp.intel.com> <1990Aug22.111018.3329@comp.vuw.ac.nz> <105536@convex.convex.com> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 17 In-Reply-To: tchrist@convex.COM (Tom Christiansen) 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. print pack("c*",(32..127)[42,85,83,84,0,65,78,79,84,72,69,82,0,48,69,82,76,0,72,65,67,75,69,82,12]) -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/