As I understand it, you can read one line at a time for both files and print each line separated by tabs, for example:
use warnings;
use strict;
die unless @ARGV == 2;
open my $fha, q|<|, $ARGV[0] or die;
open my $fhb, q|<|, $ARGV[1] or die;
while ( my $a = <$fha>, my $b = <$fhb> ) {
chomp( $a, $b );
printf qq|%s\t\t%s\n|, $a, $b;
}
This script will not work if the files have a different number of lines. You will need a different approach for this situation.
source
share