in reply to skip newline charater when reading
To do what I think you want from:
I suggest something along the lines of (i.e. untested):while ($line1 =<F1> || $line2= <F2>){ foo($line1,$line2); }
Noting that if the files are different lengths, either $line1 or $line2 may be undefined when passed to foo. Stopping as soon as the shorter hits eof is a straightforward modification -- throwing an error if the two files are supposed to be the same length as necessary.local $/ ; while (1) { $/ = "#" ; my $line1 = <F1> ; $/ = "?" ; my $line2 = <F2> ; last if (!defined($line1) && !defined($line2)) ; foo($line1, $line2) ; } ;
|
|---|