so I addedGlobal symbol "$index" requires explicit package name at /home/../scri +pts/creaNexusMatrix.pl line 12. Execution of /home/../scripts/creaNexusMatrix.pl aborted due to compil +ation errors.
and the code began;my $index;
Now the script works but I didn't obtain that I hope... I obtained:my @column; my $index; my $curr_column = 0; my $rows = 0; while( @array) { if( $array[0] ne '--' ) { $column[ $curr_column ] ||= []; # a new column push @{ $column[ $curr_column ] }, shift @array; if( $rows < $#{ $column[ $curr_column ] } ) { $rows = $#{ $column[ $curr_column ] }; }; } else { $index++; shift @array; }; }; for my $row (0..$rows) { print join "\t", map { $_->[ $row ] } @column; print "\n"; };
-- 0.0175 0.0483 0.0507 -- 0.0471 0.0483 -- 0.0287 --
In reply to Re^6: array in different columns
by Muflone82
in thread array in different columns
by Muflone82
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |