This may be what you want:

use strict; use warnings; use Data::Dumper; my $file = "1.00 InDev 01-Jun-2013 1.00 InTest 15-Jul-2013 1.00 InUAT 31-Jul-2013 1.00 InProd 15-Sep-2013 1.01 InDev 01-Jul-2013 2.00 InDev 01-Aug-2013 3.00 InDev 01-Sep-2013"; my @file_content = split( /\n/, $file ); my @full_data; for my $line (@file_content) { my @fields = split /\s+/, $line; push @full_data, \@fields; } print Dumper \@full_data;
which prints the data this way:
$ perl table.pl $VAR1 = [ [ '1.00', 'InDev', '01-Jun-2013' ], [ '1.00', 'InTest', '15-Jul-2013' ], [ '1.00', 'InUAT', '31-Jul-2013' ], [ '1.00', 'InProd', '15-Sep-2013' ], [ '1.01', 'InDev', '01-Jul-2013' ], [ '2.00', 'InDev', '01-Aug-2013' ], [ '3.00', 'InDev', '01-Sep-2013' ] ];

The four important lines:

for my $line (@file_content) { my @fields = split /\s+/, $line; push @full_data, \@fields; }
could be made much more concise:
push @full_data, [split] for @file_content;
but I preferred to keep a step by step approach to make understanding easier.

Update:: when I posted the above, Deep_Plaid had not updated the original post with the addition of the desired output. As I said in another post above, it may not be necessary to build this AoA to arrived at the desired output. The solution might be much simpler.


In reply to Re: Dynamically build a table by Laurent_R
in thread Dynamically build a table by Deep_Plaid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.