Help for this page
# assuming you've got the files open in handles $fh1 and $fh2 while (1) { ... last unless defined($line_from_file_2 = <$fh2>); # ... }