On Sun, 22 Sep 2002, Sudarshan Raghavan wrote:
> my $hashcnt = keys(%hash) + values(%hash);
Bad! my $hashcnt = keys(%hash) * 2; should do
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Fri, 20 Sep 2002, Angerstein wrote:
> I noticed if I want to print out the number of elements which should be
> stored in $#hash,
> but if i print it out i just get -1 !!
$#array (assuming the variable array is a perl array) will give you the
last index of @array. For number of elements
my $
>scalar (@array);
>scalar (%hash);
>
>can be used to get the number of elements.
For arrays, yes. For hashes, no. scalar %hash produces something that looks
like this: 3/8, which is some measure of the number of buckets used by the
hashing algo (efficiency).
print scalar keys %hash, "\n";
w
ok...
scalar (@array);
scalar (%hash);
can be used to get the number of elements.
> -Ursprüngliche Nachricht-
> Von: Angerstein [mailto:[EMAIL PROTECTED]]
> Gesendet am: Freitag, 20. September 2002 11:12
> An: [EMAIL PROTECTED]
> Betreff: Arg... what about $#hash $#arra
I noticed if I want to print out the number of elements which should be
stored in $#hash,
but if i print it out i just get -1 !!
What else can i do???
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]