a simple solution demonstrated under the Perl debugger:
DB<1> @a = a..k; DB<2> x @a 0 'a' 1 'b' 2 'c' 3 'd' 4 'e' 5 'f' 6 'g' 7 'h' 8 'i' 9 'j' 10 'k' DB<3> for my $count (0..$#a) { $start = $count - 2; $start = 0 if $ +start <0; print "@a[$start..$count]\n";} a a b a b c b c d c d e d e f e f g f g h g h i h i j i j k
In reply to Re: Sub-setting an Array
by Laurent_R
in thread Sub-setting an Array
by kgherman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |