in reply to Re: Re: Re: Answer: How do I find the index of the last element in an array?
in thread How do I find the index of the last element in an array?
Ack. Damn those non-scalar contexts!
Thus clearly showing that @a is undef. Which is true. In a list context...perl -e 'print $#a, "\n", @a, "\n", $#a+1, "\n"' -1 0
If I'd remembered to include scalar around it:
, I'd have got the right answer...perl -e 'print $#a, "\n", scalar (@a), "\n", $#a+1, "\n"' -1 0 0
My bad.
--
Tommy
Too stupid to live.
Too stubborn to die.
|
---|