in reply to How do I get the last element of an array?

perl -e "@m=(1,2,3); print $m[$#m]"

Replies are listed 'Best First'.
Re: Answer: Get the last element of an array
by Anonymous Monk on Dec 12, 2000 at 01:09 UTC
    You could also use:
    perl -e "@m-(1,2,3);print $m[-1]"
Re: Answer: Get the last element of an array
by Anonymous Monk on Dec 12, 2000 at 01:22 UTC
    python -c 'm=[1,2,3]; print m[-1]'