$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
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
On Apr 16, Glenn Cannon said:
>What is the simplest way to find out how many pairs I have in a hash?
Use the keys() function.
$nkeys = keys %hash;
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www
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.