Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: sort Message-ID: <1990Jun27.235121.7086@iwarp.intel.com> Date: 27 Jun 90 23:51:21 GMT References: <1990Jun27.204253.27285@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: 16 In-Reply-To: frech@mwraaa.army.mil (Norman R. Frech CPLS) In article <1990Jun27.204253.27285@uvaarpa.Virginia.EDU>, frech@mwraaa (Norman R. Frech CPLS) writes: | I am sorting an array of values which represent random record numbers which | I am going to extract from a large file. The problem is sort sorts the | values as alpha ?? and not as numeric, i.e. 3278 comes before 334. Is there | a way of forcing sort to treat the array as numeric in the sort? sub bynumeric {$a - $b;} @sortedarray = sort bynumeric @array; print qq/Just another Perl 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!"=/