in reply to Easier Way?

Hmm. values?

my %hash2; for my $val (sort values %hash2) { if(exists $hash2{$val}) { $hash2{$val}++; } else { $hash2{$val} = 1; } }

Not much shorter, but a bit easier to read....

--
F o x t r o t U n i f o r m
Found a typo in this node? /msg me
The hell with paco, vote for Erudil!

Replies are listed 'Best First'.
Re: Re: Easier Way?
by thelenm (Vicar) on Aug 28, 2002 at 21:49 UTC
    In fact, the sort and the if test are unnecessary, so we can further reduce the code to this:
    my %hash2; $hash2{$_}++ for values %hash1;

    -- Mike

    --
    just,my${.02}