in reply to Re: foreach only for a section of a list
in thread foreach only for a section of a list
I don't get it. Instead of
say for do { my @arr = @arr[ 0 .. $#arr - 1 ]; @arr};
et al, why not just
say for do { @arr[ 0 .. $#arr-1 ] };
or (much) better yet...
>perl -wMstrict -lE "my @arr = qw{ one two three four }; say for @arr[ 0 .. $#arr-1 ]; say qq{@arr}; " one two three one two three four
|
|---|