<snip>
> print "$#list\n";
> print scalar(@list);
>
> would return
>
> 3
> 4
Unless somebody was messing with the $[ (array index starts at)
variable. Example:
<code>
#!/usr/bin/perl -w
use strict;
my @list = qw(one two three four);
print "The last element of \@list is $#list\n";
print "There are ", scalar(@list), " elements in \@list\n";
$[ = 5;
print "The last element of \@list is $#list\n";
print "There are ", scalar(@list), " elements in \@list\n";
</code>
<output>
The last element of @list is 3
There are 4 elements in @list
The last element of @list is 8
There are 4 elements in @list
</output>
Messing with $[ is unhealthy and a sign of a very sick mind.
--
Today is Pungenday, the 17th day of Confusion in the YOLD 3167
P'tang!