Hi all, I came across a program which transpose the contents in the file. I would like to know what is meant by the line : $outline[$i] = "\t" x $oldlastcol; The entire code is as follows:
Thanks.while (<MYFILE>) { chomp; @line = split /\t/; $oldlastcol = $lastcol; $lastcol = $#line if $#line > $lastcol; for (my $i=$oldlastcol; $i < $lastcol; $i++) { $outline[$i] = "\t" x $oldlastcol; } for (my $i=0; $i <=$lastcol; $i++) { $outline[$i] .= "$line[$i]\t" } } for (my $i=0; $i <= $lastcol; $i++) { $outline[$i] =~ s/\s*$//g; print $outline[$i]."\n"; }
In reply to Transpose the contents of the file by snape
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |