in reply to joining to files into columns

The following (untested) code should help:

use strict; use warnings; open IN, '<', "file1" or die "Failed to open file1: $|"; open IN2, '<', "file2" or die "Failed to open file2: $|"; open OUT, '>>', "joinfile" or die "Failed to open joinfile: $|"; while (! eof (IN) || ! eof (IN2)) { my $file1 = <IN> || '!! missing file1 line !!'; my $file2 = <IN2> || '!! missing file2 line !!'; chomp $file1; chomp $file2; print OUT "$file1 $file2\n"; }

Note that a few things have been cleaned up:

If you want to stop when either file runs out of lines change the || to an &&.


DWIM is Perl's answer to Gödel