in reply to Combining Lines from Two Docs into Another

Assumes that file1.txt and file2.txt contain the same number of lines.

#! /usr/bin/perl -w use strict; open (my $file1, '<', 'file1.txt') or die $!; open (my $file2, '<', 'file2.txt') or die $!; while (my $line1 = <$file1>) { chomp $line1; my $line2 = <$file2>; print $line, ' ', $line2; } close $file1; close $file2;
Update: Code correction.