That's an odd way to get subsets of three elements. You can't grab them three at a time and maybe the end one has fewer than three elements? As in the example in the docs for splice?
sub nary_print { my $n = shift; while (my @next_n = splice @_, 0, $n) { say join q{ -- }, @next_n; } } nary_print(3, qw(a b c d e f g h)); # prints: # a -- b -- c # d -- e -- f # g -- h
In reply to Re^3: Sub-setting an Array
by 1nickt
in thread Sub-setting an Array
by kgherman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |