Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!ogicse!decwrl!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: sort Message-ID: <1990Aug21.224327.20194@iwarp.intel.com> Date: 21 Aug 90 22:43:27 GMT References: <1990Aug21.202005.26275@uvaarpa.Virginia.EDU> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 25 In-Reply-To: frech@mwraaa.army.mil (Norman R. Frech CPLS) In article <1990Aug21.202005.26275@uvaarpa.Virginia.EDU>, frech@mwraaa (Norman R. Frech CPLS) writes: | Due to great stupidity I lost my one of my programs which contained an | sort of an array of integers. Naturally, I need the logic and my sort | is sorting on the character string representations. I tried the | subroutine in the perl.man with no success. Would someone please | send me the logic for a numeric sort of an array. Thanks... sub by_the_numbers { $a - $b; } @a = (3,5,7,9,11,13,15,16,14,12,10,8,6,4,2); @sorta = sort by_the_numbers @a; print "@sorta\n"; How's that? print "Just another Perl (book) hacker," -- /=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!"=/