in reply to Counting number of keys in a hash.

try $hash_cnt = scalar keys %hash

HTH

Sweetblood

Replies are listed 'Best First'.
Re^2: Counting number of keys in a hash.
by naChoZ (Curate) on Jul 27, 2004 at 22:29 UTC

    Thanx from me too. I just had to do this today actually. I figured there was a better way than my quick solution of:

    my $counter = 0; $counter++ for keys %hash;

    --
    "A long habit of not thinking a thing wrong, gives it a superficial appearance of being right." -- Thomas Paine
    naChoZ