RE: "$#{$array} "
- From: john.moon@xxxxxxxxxxxxx (John Moon)
- Date: Fri, 29 Jul 2005 07:33:24 -0400
Subject: "$#{$array} "
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 = \@array;
print "the highest element is number $#{$array_r}\n";
FYI ...
SUN1-BATCH>perl -e '@a=(1 .. 5); print "List max index = $#a and has " .
scalar(@a) . " elements\n";'
List max index = 4 and has 5 elements
SUN1-BATCH>
.
- Prev by Date: RE: Read a single line in a file.
- Next by Date: Re: "$#{$array} "
- Previous by thread: Re: "$#{$array} "
- Next by thread: Grep uniqueness issue
- Index(es):
Relevant Pages
|
|