perl进行行列转置

use strict;
open IN,"<1.Book";
open OUT,">final.txt";
my $i=0;
my @data;
while(){
    chomp;
     my @line=split/\t/,$_;
     for my $k(0 .. $#line){
         $data[$k][$i]=$line[$k];
     }
     $i++;
 }
 close IN;
 for (@data){
 print OUT join("\t",@{$_}),"\n";
 }

你可能感兴趣的:(perl进行行列转置)