in reply to joining to files into columns

One helpful hint: you almost never want to read a file in a "for" loop as you have it. You are reading the entire file into memory. If you don't care about reading the whole thing into memory, then you may as well do:
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"; }
If you don't want to read the entire contents into memory, then you'll need to eliminate the inner loop. Something like:
{ my $line1 = <IN1>; my $line2 = <IN2>; last unless $line1 or $line2; chomp for $line1, $line2; print "$line1 $line2\n"; redo; }