in reply to joining to files into columns
If you don't want to read the entire contents into memory, then you'll need to eliminate the inner loop. Something like:my @file1 = chomp( <IN1> ); my @file2 = chomp( <IN2> ); my $last = (@file1 > @file2) ? $#file1 : $#file2; for my $line (0..$last) { print "$file1[$line] $file2[$line]\n"; }
{ my $line1 = <IN1>; my $line2 = <IN2>; last unless $line1 or $line2; chomp for $line1, $line2; print "$line1 $line2\n"; redo; }
|
|---|