in reply to Re: scalar subkeys %hash ?
in thread scalar subkeys %hash ?

Or more idiomatically:
$numSubKeys = map keys %$_, values %hash;
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: Re: Re: scalar subkeys %hash ?
by srawls (Friar) on Jun 14, 2001 at 04:38 UTC
    Nice... At first I tried that, only I forgot to put values %hash instead of keys. Oh well.

    Oh, and if this were a golf, I could improve that by 2 chars:

    $n=map keys%$_,each%h

    Update:Whoops, as MeowChow pointed out, this doesn't work for hashes with more than one key.

    The 15 year old, freshman programmer,
    Stephen Rawls