I have started learning perl and like to try out new things.
I have some problem in text processing. I have some text of the form,
0 1 2 3 4 5 6 7 8
Here's an outline of one way to transpose data. Working through this example will be instructive because you will need to use CPAN, you will learn about the useful List::Util and List::MoreUtils modules, you will learn the basics of complex data structures (see perlreftut, perldsc, and perllol), and you will get to use an iterator in Perl.
use strict;
use warnings;
use List::MoreUtils qw(each_arrayref);
my @raw_data = (
'0 1 2 3 4 5 6 7 8 9 10',
'6 7 3 6 9 3 1 5 2 4 6',
);
my @rows = ... ; # Look up map() and split() to fill in the rest.
# You want an array of arrays.
my @transposed; # You will build this in the loop below.
my $iter = each_arrayref(@rows); # See List::MoreUtils documentation.
while ( my @tuple = $iter->() ){
# Do stuff here to build up @transposed, which
# will also be an array of arrays.
}