Curtis Poe wrote:
> 
> --- "F.H" <[EMAIL PROTECTED]> wrote:
> > Hi There,
> > I am trying to get a count of elements of a reference to an array.
> > $reftest = \@test
> > $#reftest, doesn't seem to yield the number of arry elements.
> > I appreciate if someone can help
> > Thanks
> > I.S
> 
> In any event, "print $#test" will print the value of the last index, which is the 
>number of
> elements minus one.  If you want the number of elements from a reference, you can do 
>this:
> 
>     print $#$reftest+1;
> 
> Or
> 
>     print scalar @$reftest; # yuck


$ perl -le'$[=5;
@test = qw(one two three four five);
$reftest = \@test;
print $#$reftest + 1;
print scalar @$reftest;
'
10
5



:-)

John
-- 
use Perl;
program
fulfillment

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

Reply via email to