in reply to Find number of unique values in hash

my $i; for (values %hoh) { $_->{age} == 12 && $i++; }

PS: ah, you want to do it "without looping through each hash and counting." No, I don't think that's possible.

Replies are listed 'Best First'.
Re^2: Find number of unique values in hash
by AnomalousMonk (Archbishop) on Jan 19, 2010 at 23:26 UTC
    rethaew want[s] to do it "without looping through each hash and counting." No, I don't think that's possible.

    I agree. Even a solution like
        my $age12 = grep $_->{age} == 12, values %hoh;
    implicitly loops through the hash. rethaew will have to wait for the arrival of the personal desktop quantum computer to solve the problem without looping.