in reply to Need help on hashes.
should do the trick (untested).my %countries; while (<DB>){ my @entries = split m/,/, $_; $countries{$entries[1]}++; } for (reverse sort { $countries{$a} <=> $countries{$b} } keys %countrie +s){ print "$_\t\$countries{$_}\n"; }
Update: no, the \ was not intentional, of course it's print "$_\t$countries{$_}\n";. Thanks cdarke.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need help on hashes.
by cdarke (Prior) on Feb 04, 2008 at 09:08 UTC | |
by ElMagnifico (Initiate) on Feb 04, 2008 at 23:06 UTC |