http://www.perlmonks.org?node_id=665922


in reply to Re: Need help on hashes.
in thread Need help on hashes.

Is the \ in front of the $ in the print statement intentional? That gives:
"US" $countries{"US"} "DE" $countries{"DE"} "RU" $countries{"RU"} "UK" $countries{"UK"} "FR" $countries{"FR"}
Also it retains the quotes around the country code. I have:
my %countries; while (<DB>){ my $entry = (split /","/, $_)[1]; $countries{$entry}++; } for (reverse sort { $countries{$a} <=> $countries{$b} } keys %countrie +s){ print "$_\t$countries{$_}\n"; }