#!/usr/bin/perl -w use strict; # Transponoi taulukko # # Praatissa esim. näin: # # select Matrix xy # Transpose my @table; sub transpose { my @old = @_; my @new; for(my $i = 0; $i < @old; $i++){ for(my $j = 0; $j < @{$old[$i]}; $j++){ $new[$j][$i] = $old[$i][$j]; } } return @new; } while(<>){ chomp; push @table, [split]; } print join("\t", @$_),"\n" for transpose @table;