Vineet Pande wrote:
Hi,
I don't not understand how the $#{$array_r} returns "highest" element as 4 and not 5???

#!/usr/bin/perl
use warnings;
use strict;
my @array = (1,2,3,4,5);
my $array_r = [EMAIL PROTECTED];
print "the highest element is number $#{$array_r}\n";

Cheers
V

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/



You can also write this as $#$array_r if you are into perl golf.

if you want the last value:
$$array_r[$#$array+1]  or $array_r->[$#$array+1]
( but never use $#$array_r++ !!! )

To get the true length:  $#$array + 1

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to