Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!uvaarpa!mmdf From: frech@mwraaa.army.mil (Norman R. Frech CPLS) Newsgroups: comp.lang.perl Subject: sort Message-ID: <1990Jun27.204253.27285@uvaarpa.Virginia.EDU> Date: 27 Jun 90 20:42:53 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: frech@mwraaa.army.mil Organization: The Internet Lines: 23 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? ***portion of code follows *** #generate 50 random record numbers of file.in in sorted order $rc = `wc -l file.in`; $i = 0; for (1..50) { $i = $i + 1; @pickval[$i] = int(rand($rc)) + 5; } @picksort = sort @pickval; $i = 0; for (1..50) { $i = $i + 1; print @picksort[$i],"\n"; } Norm Frech < frech@mwraaa.army.mil >