Galen has asked for the wisdom of the Perl Monks concerning the following question:
Is there a method for directly retrieving the size of a hash, or must I use an array?
%somehash = ( key1 => "value1", key2 => "value2", key3 => "value3, key4 => "value4", ); @keys = keys %somehash; $size = @keys; print "This hash holds $size key-value pairs\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: hash size
by davorg (Chancellor) on Apr 18, 2001 at 20:14 UTC | |
Re: hash size
by arturo (Vicar) on Apr 18, 2001 at 20:17 UTC | |
Re: hash size
by larsen (Parson) on Apr 18, 2001 at 20:54 UTC | |
Re: hash size
by zigster (Hermit) on Apr 18, 2001 at 20:18 UTC |
Back to
Seekers of Perl Wisdom