#Maybe this what you mean???? open (F1, '<' ,$file1) or die "Cannot open file $file1 for reading\n"; open (F2, '<', $file2) or die "Cannot open file $file2 for reading\n"; #### while ( , ) { # throw away a line from file F1 - never to be used # end the loop if there are no more lines in F2 # set $_ to the next line from F2 # plays no role here - it is a No-Operation: NoOp } #### while ( ) { # $_ is a line from $file2 }