In Perl 5, when we have a named array, e.g. @a, getting the elements from index $N onwards is simple with a bit of slicing:
my @result = @a[$N..$#a];
Is there a standard way to do the same with an anonymous array, without having to supply the length explicitly? I.e. can this:
my @result = (0,1,2,3,4,5)[2..5];
or, more specifically, this:
my @result = (0,1,2,3,4,5)[$N..5];
be converted to something that does not need the upper range limit to be explicit? Perhaps some obscure Perl syntax? Maybe a bit of dicing instead of slicing?
PS: I have already written this as a function – I am looking for a more self-contained approach.
You can
spliceit: