develooper Front page | perl.perl5.porters | Postings from January 2014

Re: Range idea

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
January 23, 2014 19:56
Subject:
Re: Range idea
Message ID:
20140123195608.5995.qmail@lists-nntp.develooper.com
On 2014-01-23 20:33, Aristotle Pagaltzis wrote:

> What if I want the two last elements of the list, no matter
> how long it is?)

But we already have that:

perl -wE'say for qw( a b c d e)[-2..-1]'
d
e

-- 
Ruud



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About