in reply to Grabbing lines three-by-three from a file

If you aren't too concerned with memory usage...
my @data = (<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"); }