home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!gatech!rpi!think.com!ames!sun-barr!sh.wide!wnoc-tyo-news!sranha!sranhd!sran230!utashiro
- From: utashiro@sran230.sra.co.jp (Kazumasa Utashiro)
- Subject: Re: Looking for a "numerical/alpha" sort routine.
- References: <1992Dec23.193120.25893@pool.info.sunyit.edu>
- Organization: Software Research Associates, Inc., Japan
- Date: Thu, 24 Dec 1992 03:21:24 GMT
- Message-ID: <Bzqunp.9rD@sran230.sra.co.jp>
- Lines: 13
-
- In article <1992Dec23.193120.25893@pool.info.sunyit.edu>
- buck@pool.info.sunyit.edu (Jesse Buckley) writes:
- >> Does anyone have a sort/compare routine that will work for numerical
- >> alpha data? For example, if I have 1, 2, 3a, 3b, 3c, I want them sorted
- >> that way. Right now the <=> compare ignored the letters after the
- >> numbers. Thanks.
-
- Next line works for your example.
-
- @s = sort { $a <=> $b || $a cmp $b } ('3c', '1', '3a', '2', '3b');
- print "@s\n";
-
- --utashiro
-