#!perl -w use strict; while () { chomp; print "current line=$_\n"; if (/check next/) { my $pos = tell(); my $testline = ; chomp $testline; print "'next line' = $testline\n"; #do something... seek DATA, $pos, 0; } print "current line=$_\n"; } __DATA__ line 1 line 2 line 3 check next line 4 OK? line 5