http://qs321.pair.com?node_id=11148540


in reply to Re: Converting python list range expressions to perl
in thread Converting python list range expressions to perl

you posted first. I did come up with a slight variation on the 2nd task.
use strict; use warnings; use 5.10.0; #for say #a = [ 'a','b','c','d','e','f','g' ] my @a = qw(a b c d e f g); #a[:3] # abc say @a[0..2]; # only first 3 #a[:-3] # abcd say @a[0..$#a-3]; # exclude last 3 #a[3:] # defg say @a[3..$#a]; # exclude first 3 #a[-3:] # efg say @a[-3..-1]; # only last 3