in reply to Transpose a file
use Text::CSV; use Array::Transpose; use Data::Dump; use feature qw (say); use strict; use warnings; my $file = q(data.txt); my $csv = Text::CSV->new ({ binary => 0, eol => $/,sep_char=>' ' }); my @data; open my $in, "<", $file or die $!; while (my $row = $csv->getline ($in)) { push @data, $row; } close $in; @data= transpose \@data; # dd \@data; open my $out, ">", "out.txt" or die $!; for (@data) {$csv->print ($out, $_)} close $out; __END__
Update: VinsWorldcom mentioned it already... i couldn't type so fast ;-)...deleted unused variable
Regards, Karl
«The Crux of the Biscuit is the Apostrophe»
|
|---|