my @data = (); chomp @data; my $i = 0; while($i+2 <= $#data) { my @three = @data[$i..$i+2]; print "@three\n"; $i++; # Do stuff to process @three print $_,"\t" for ( @three ); print("\n\n"); }