in reply to Sub-setting an Array

Hi,

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