neb has asked for the wisdom of the Perl Monks concerning the following question:
$market_hash is a reference to a hash which has values that are references to arrays. I am interested in sorting the has on the 2nd value in the array that is the value. Any ideas why this doesn't work? benforeach my $market (sort { $market_hash->{$a}[1] cmp $market_hash->{$ +b}[1] } keys (%{$market_data}) ) { print "$market,$market_hash->{$market}[1],$average\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sorting a hash of arrays by the seconds value of the array
by runrig (Abbot) on Dec 11, 2001 at 03:46 UTC | |
by neb (Initiate) on Dec 11, 2001 at 04:03 UTC |