in reply to Reading multiple files.
Probably a little easier to test if you're using lexical file handles.while (!eof(FILE1) && !eof(FILE2)) { my $line1 = <FILE1>; my $line2 = <FILE2>; ...
use strict; use warnings; open my $fh, $0 or die $!; my @fhs = (\*DATA, $fh); while (! grep {eof($_)} @fhs) { my @lines = map {scalar <$_>} @fhs; print for @lines; } __DATA__ line1 line2 line3 line4 line5 line6
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading multiple files.
by pspillai (Initiate) on Mar 24, 2011 at 18:32 UTC | |
by GrandFather (Saint) on Mar 24, 2011 at 19:56 UTC |