Something like this:
# assuming you've got the files open in handles $fh1 and $fh2 while (1) { last unless defined($line_from_file_1 = <$fh1>); last unless defined($line_from_file_2 = <$fh2>); # ... }
Basically you just use the "read a record" operator (<>, aka diamond operator) on each file handle. See also readline.
In reply to Re: reading lines from 2 different files
by duff
in thread reading lines from 2 different files
by indapa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |