home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / perl / 7609 < prev    next >
Encoding:
Text File  |  1992-12-24  |  952 b   |  27 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!mcsun!sun4nl!ruuinf!piet
  3. From: piet@cs.ruu.nl (Piet van Oostrum)
  4. Subject: Re: Looking for a "numerical/alpha" sort routine.
  5. Sender: network-news@cs.ruu.nl
  6. Message-ID: <1992Dec24.125700.6133@cs.ruu.nl>
  7. In-Reply-To: utashiro@sran230.sra.co.jp (Kazumasa Utashiro)
  8. Date: Thu, 24 Dec 1992 12:57:00 GMT
  9. Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
  10. References: <1992Dec23.193120.25893@pool.info.sunyit.edu> <Bzqunp.9rD@sran230.sra.co.jp>
  11. Organization: Dept of Computer Science, Utrecht University, The Netherlands
  12. Lines: 13
  13.  
  14. >>>>> utashiro@sran230.sra.co.jp (Kazumasa Utashiro) (KU) writes:
  15.  
  16. KU> Next line works for your example.
  17.  
  18. KU> @s = sort { $a <=> $b || $a cmp $b } ('3c', '1', '3a', '2', '3b');
  19. KU> print "@s\n";
  20.  
  21. This fails however in the presence of leading zeroes in the mixed keys:
  22.  
  23. @s = sort { $a <=> $b || $a cmp $b } ('3c', '1', '3a', '2', '03b');
  24. print "@s\n";
  25. -- 
  26. Piet van Oostrum <piet@cs.ruu.nl>
  27.