in reply to Re: count sort & output
in thread count sort & output

if (defined($hash{$key}) { $hash{$key} ++; } else { $hash{$key} = 1; }
That's actually more work than necessary.
All you need is     $hash{$key}++; because if the element doesn't yet exist, it will be created and initialized ("autovivified") to undef, then the undef will be nummified to 0, then the 0 will be incremented to 1.

%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"; }
No, that's bad. What if both yahoo and google have a value of 100?
All you're really trying to do it print out the entries sorted by value, numerically.
(And, btw, you were sorting lexically, which is also wrong.)
%hash = ( www.yahoo.com => 10, www.google.com => 2000, ); for ( sort { $hash{$a} <=> $hash{$b} } keys %hash ) { print "$_ appears: $hash{$_} time(s)\n"; }

jdporter
...porque es dificil estar guapo y blanco.