use strict; use warnings; ### open the first file and store in to a array format open (F1, "file1.txt") || die "Cannot open the input file : $!"; my @file1=; close (F1); ### open the second file and store in to a array format open (F2, "file2.txt") || die "Cannot open the input file : $!"; my @file2=; close (F2); my @file3; ### process each element and store the file1 and the corresponding ### value in second file in another one array for (my $i=0; $i<=$#file1; $i++) { chomp($file1[$i]); push @file3, "$file1[$i]\t$file2[$i]"; } ### print the array in a output file open (FOUT, ">Concat.txt") || die "Cannot create the output file"; print FOUT @file3; close (FOUT);