Z
Zhiliang Hu
I have a hash with multiple values, like in:
Marty => 32877::2
Bart => 14857::2
Torq => 65221::1
etc
and I wish to sort on. say, first field of the hash value:
foreach $key (sort mysort keys %hasha ) { ... }
sub mysort {
map { $_->[0] }
sort { $a->[0] cmp $b->[0] }
map { [ $_, split(/::/,[0] ] }
}
but confused as how to 'map' the elements... need help -- Thanks in
advance!
Marty => 32877::2
Bart => 14857::2
Torq => 65221::1
etc
and I wish to sort on. say, first field of the hash value:
foreach $key (sort mysort keys %hasha ) { ... }
sub mysort {
map { $_->[0] }
sort { $a->[0] cmp $b->[0] }
map { [ $_, split(/::/,[0] ] }
}
but confused as how to 'map' the elements... need help -- Thanks in
advance!