Larsen, Errin M HMMA/IT wrote:
  <<SNIP>>

# or, since [EMAIL PROTECTED] will always be the index of the last

element of


the
array:
print $a->[-1]


Did I get it right? That looks like homework to me ... Why

would you


ever do that in a practical script?

--Errin


I think you got it. Ever want the last item in a list, I can think of lots of reasons to want that...


http://danconia.org



Yeah.  I agree.  However, I always use the $ARRAY[-1] (or,
$ARRAYREF->[-1]) syntax to get at the last element.

Why would I ever type: [EMAIL PROTECTED] ?!?


Uh, I wouldn't either, apparently if you didn't know about the -1 capability like the OP :-). TMTOWTDI.


Btw ... What perldoc can I read to read about '$#'?


Not sure, a quick glance at perldata discusses the -1 index usage, but didn't turn up $# that I could see. Its in the books :-).


--Errin


http://danconia.org

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