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:
Also it retains the quotes around the country code. I have:"US" $countries{"US"} "DE" $countries{"DE"} "RU" $countries{"RU"} "UK" $countries{"UK"} "FR" $countries{"FR"}
my %countries; while (<DB>){ my $entry = (split /","/, $_)[1]; $countries{$entry}++; } for (reverse sort { $countries{$a} <=> $countries{$b} } keys %countrie +s){ print "$_\t$countries{$_}\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Need help on hashes.
by ElMagnifico (Initiate) on Feb 04, 2008 at 23:06 UTC |
In Section
Seekers of Perl Wisdom