Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Numeric Sorting on Characters

by Kenosis (Priest)
on Aug 14, 2013 at 21:16 UTC ( [id://1049480]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    
    my %hash = map { $_ => 1 } qw/987-665-888 456-123-000 000-000-000 123-
    +456-789/;
    print "$_\n" for sort { $a =~ s/-//gr <=> $b =~ s/-//gr } keys %hash;
    
  2. or download this
    000-000-000
    123-456-789
    456-123-000
    987-665-888
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1049480]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-26 08:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found