open (F, "log.txt") or die "Couldn't open: $!"; while (1) { my $line1 = ; # Get a line my $line2 = ; # Get another line last unless defined($line1); # bail if there's no data #... now you can filter what you want here, # match, print, push whatever. All the data you # care about is in $line1 and $line2 }