Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Size of a hash 2

Status
Not open for further replies.

jerehart

Programmer
Jun 10, 1999
61
0
0
US
How do I figure out the size of a hash? I am looking for something similar to $#ARRAY for an array size. Is there another way other than traversing through the whole hash?
 
There's no "size" function that I am aware of, but this should work:

Code:
$i=0;
while (($key,$value) = each %YOURHASH) { $i++; }

Hope that helps,
Segfault
 
SCHWEEEET! that is what I was looking for Brendan, thanks!

Miah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top