Murcia has asked for the wisdom of the Perl Monks concerning the following question:
Hi Confreres, i want to sort by hash keys. How can I define exceptions? e.g "normal"
my %hash = (auto=>1, bike=>1, foot=>1, motorbike=>1, boot=>1); for (sort {$a cmp $b } keys %hash){ print; }
result : auto, bike, boot, foot, motorbike
but how if it should be
foot, auto, bike, boot, motorbike
<-first-> <- sorted ->
thanks in advance!
Murcia
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sort hash exceptions
by edan (Curate) on Jan 26, 2004 at 14:01 UTC | |
by japhy (Canon) on Jan 26, 2004 at 16:23 UTC | |
by ysth (Canon) on Jan 26, 2004 at 23:01 UTC | |
|
Re: sort hash exceptions
by Abigail-II (Bishop) on Jan 26, 2004 at 13:55 UTC | |
| |
|
Re: sort exceptions
by ysth (Canon) on Jan 26, 2004 at 23:08 UTC |