Beware: What does that solution do, if $n > @source?
See:$ perl -le '@a = 1..3; @b = @a[(@a-5)..$#a]; print "<$_>" for @b;' <2> <3> <1> <2> <3>
In reply to Re^2: What’s the best way to get the last N elements of a Perl array?
by linuxer
in thread What’s the best way to get the last N elements of a Perl array?
by vinoth.ree
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |