- or download this
if (defined($hash{$key}) {
$hash{$key} ++;
} else {
$hash{$key} = 1;
}
- or download this
$hash{$key}++; - or download this
%hash = ("www.yahoo.com", 10, "www.google.com", 2000);
foreach (keys %hash) {
$rev_hash{$hash{$_}} = $_;
...
foreach (sort keys %rev_hash) {
print "$rev_hash{$_} appears: $_ time(s)\n";
}
- or download this
%hash = (
www.yahoo.com => 10,
www.google.com => 2000,
...
print "$_ appears: $hash{$_} time(s)\n";
}