Friday, July 8, 2011

Perl Script to merge files

use strict;
use warnings;

my @fh=map {
     open my $fh, '<' , $_ or die "can't open '$_':$! \n "; $fh
} @ARGV;

my $l;
while (@fh){
     @fh=grep !eof $_, @fh;
     print $l=join "\t", map {chomp(my $line=<$_>);$line}@fh;
     print "\n";
}