in reply to Re^3: How to concatenate a generic array of arrays and an array of hashes
in thread How to concatenate a generic array of arrays and an array of hashes

Could use Text::Table for the output. Using an array of arrays, (also could use hash of arrays with a few adjustments to the code).
#!/usr/bin/perl use strict; use warnings; use Text::Table; use List::Util 'max'; my @final = ( [ 'Line_1_3', 'Line_2_3' ], [ 'Line_3_3' ], [ 'Line_4_3', 'Line_5_3', 'Line_6_3', 'Line_7_3' ] ); my $max_idx = max map $#$_, @final; my $tb = Text::Table->new; for my $i (0 .. $max_idx) { $tb->add( map $final[$_][$i], 0 .. $#final); } print $tb

The hash method.

#!/usr/bin/perl use strict; use warnings; use Text::Table; use List::Util 'max'; my %final = ( 'sample.txt' => [ 'Line_1_3long', 'Line_2_3' ], 'sample_2.txt' => [ 'Line_3_3longer' ], 'sample_3.txt' => [ 'Line_4_3', 'Line_5_3', 'Line_6_3evenlonger', 'Line_7_3', ] ); my $max_idx = max map $#$_, values %final; my $tb = Text::Table->new; for my $i (0 .. $max_idx) { $tb->add( map $final{$_}[$i], sort keys %final); } print $tb

Replies are listed 'Best First'.
Re^5: How to concatenate a generic array of arrays and an array of hashes
by AppleFritter (Vicar) on Jul 07, 2014 at 19:35 UTC
    Wow, nice, thanks for the pointer. That's a module I'll have to remember.
Re^5: How to concatenate a generic array of arrays and an array of hashes
by thanos1983 (Parson) on Jul 08, 2014 at 00:34 UTC

    Dear Christoforo,

    Respect, I was starting to get the impression that my problem can not be solved. I tried infinite possible solutions. I am not expert on perl, maybe not even moderate operator in comparison to so many people here. I have been trying like crazy 5 days to solve it, and so far not successful.

    Thanks a lot, I was about to give up.

    Seeking for Perl wisdom...on the process...not there...yet!
      Hello thanos1983

      I'm glad to help. The more one uses and reads about perl, the better they get at it. Your problem was interesting to solve. Feel free to ask for help anytime and, if I can contribute, I'll be happy to do so!