行列转置的小脚本
#!/usr/bin/perl -w
use strict;
my %out;
open IN, $ARGV[0] || die $!;
while(<IN>){
chomp;
my @a = split /\t/, $_;
for (my $i=0;$i<@a;$i++){
$out{$i}{$.} = $a[$i];
}
}
close IN;
foreach my $k (sort {$a<=>$b} keys %out ){
my $out;
foreach my $d (sort {$a<=>$b} keys $out{$k}){
$out .= "$out{$k}{$d}\t";
}
$out =~ s/\t$//g;
print "$out\n";
}
__END__
sxliulian2009@126.com