kalyanrajsista has asked for the wisdom of the Perl Monks concerning the following question:
Monks
I'm trying to sort the hash based on their keys and key is inform of some 'UniqueNumber-Sequence'. Here is what I tried.... Output should be like
1035-46 1035-65 1035-2341 1035-2347
#!/usr/bin/perl my %seq = ( '1035-2341', '1', '1035-2347', '1', '1035-65', '1', '1035- +46', '1'); foreach ( sort {$a cmp $b } keys %seq ) { print $_, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sort hash keys
by GrandFather (Saint) on Sep 17, 2010 at 10:04 UTC | |
|
Re: Sort hash keys
by johngg (Canon) on Sep 17, 2010 at 10:32 UTC | |
by kalyanrajsista (Scribe) on Sep 17, 2010 at 11:00 UTC | |
|
Re: Sort hash keys
by JavaFan (Canon) on Sep 20, 2010 at 12:54 UTC |