while (my $w1 = <FILE> and my $w2 = <FILE2>) { if ($w1 lt $w2) { print "\n"; $w1 = <FILE>; } elsif ($w1 gt $wt) { print "\n"; $w2 = <FILE2>; } else { print $w1; } } # Leftover lines in either file? print "\n" while <FILE>; print "\n" while <FILE2>;
In reply to Re: Loop through 2 files in parallel
by Roy Johnson
in thread Loop through 2 files in parallel
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |