Hi,

Hello,

I don't not understand how the $#{$array_r} returns "highest" element as 4 and not 5???

Because array elements are indexed starting at 0 not 1 and $#array returns the element nuumber not its value. See example below:

#!/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";

perl -mstrict -we 'print "The highest index number is $#INC\nThat value is \"$INC[ $#INC ]\"\n";'

--
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