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 $arrcnt = @array; By $#hash I assume you are trying this on a hash. Well, it will not work Just saw your other post scalar(%hash) will not work either you will get a value like 3/8 or 9/16 or something like that. This will work my $hashcnt = keys(%hash) + values(%hash); Also you have not enabled the strict pragma, $#hash will result in a compilation error (i.e. if you don't have a variable @hash) if the strict had been enabled. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]