#!/usr/bin/perl use strict; use warnings; my $file1 = $ARGV[0] || 'file1.txt'; my $file2 = $ARGV[1] || 'file2.txt'; open (FILE1, '<', $file1) or die "Unable to open $file1 for reading : $!"; open (FILE2, '<', $file2) or die "Unable to open $file2 for reading : $!"; while ( ) { chomp; my $foo = ; $foo = 'N/A' if eof FILE2; print join "\t" , $_ , $foo; print "\n"; } while ( ) { chomp; print join "N/A\t$_\n"; }