$total =  keys %hash;
Mike

-----Original Message-----
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 12:44 AM
To: 'Glenn Cannon '; '[EMAIL PROTECTED] '
Subject: RE: Counting pairs in a hash.


I'm sure there is a better way, but you could do it this way:

foreach(keys %hash){
   $count++;
}

print "$count keys.\n";

-----Original Message-----
From: Glenn Cannon
To: [EMAIL PROTECTED]
Sent: 4/16/02 7:20 PM
Subject: Counting pairs in a hash.

All,
 
What is the simplest way to find out how many pairs I have in a hash?
 
I am putting a variable number in when reading data from a file, and I
then need to split the file in half for display.
 
Thx,
 
Glenn.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to