Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: sort Message-ID: <105536@convex.convex.com> Date: 29 Aug 90 02:00:50 GMT References: <1990Aug21.224327.20194@iwarp.intel.com> <1990Aug22.111018.3329@comp.vuw.ac.nz> Sender: usenet@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 16 In article Mike.McManus@FtCollins.NCR.com (Mike McManus) writes: >Interestingly enuff, I had need for a similar sorting routine today, but with a >twist: I want to sort the indices of an associative array that are of the form >"A0, A1, A2, ..., A9, A10, ..." Of course an alphabetic sort returns "A0, A10, >A11, A19, ..., A1, ...", not what I want! > >Any simple solutions? Thanks! Is this simple enough for the sort function? sub bynum { substr($a,$[+1,10) > substr($b,$[+1,10); } --tom -- "UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." [Doug Gwyn]