how do you print one line then get out of the loop and go back to it later and print the second line, what i mean is how do print line 1 from file a and then print line 1 of file b and then print line 2 file a and then line2 file b and so on.
use strict;
use warnings;
open (T1, "t1") or die;
my $line;
my $flag = 1;
my $counter;
DATA:
while (<DATA>) {
print;
goto T1;
}
T1:
while (<T1>) {
print;
goto DATA;
}
__END__
file1
file1
file1
file1
#!/usr/bin/perl -w
use strict;
my ($fh1, $fh2);
open $fh1, "file1.dat" or die "I no read file 1.\n";
open $fh2, "file2.dat" or die "I no read file 2.\n";
my $mainfh = $fh1;
while (<$mainfh>) {
print;
$mainfh = ($mainfh == $fh1) ? $fh2 : $fh1;
}