it can combine any number of files with column of each file one by one as long as those files have same filed seperator.
#! /usr/bin/perl -w
sub combine{
my $sep=shift;
my $num=$#_+1;
for ($i=0;$i<=$num-1;$i++){
open FH,$_[$i] or die "Can not open file";
while(<FH>){
my @tmp=split($sep,$_);
map {tr/\n//d} @tmp;
for($j=0;$j<$#tmp;$j++){
@{$hash{$tmp[0]}}->[$j*$num+$i]=$tmp[1+$j];
}
}
}
return \%hash;
}
$ref=combine(" ","a.txt","b.txt","c.txt");
%hash=%{$ref};
for $key (keys %hash){
print $key,":",join ":",@{$hash{$key}};
print "\n";
}