in reply to How can I populate a hash?

No need to use x @a, just assign an empty list.

DB<1> @a = qw( a b c d a b ) DB<2> @h{@a} = () DB<3> x keys %h 0 'c' 1 'a' 2 'd' 3 'b'

Update: Gah, yeah I missed the count part. I agree with below it's a "I want to do iterative task X without iterating" problem. Now I'm going to take a nap before attempting to answer anything else . . .

Replies are listed 'Best First'.
Re^2: How can I populate a hash?
by friedo (Prior) on Jan 25, 2005 at 22:14 UTC
    That will eliminate duplicates, but it will not count them.