Hi Deep Plaid,
.. I know a hash won't work because I will have rows of data with "keys" that are duplicated, and that have multiple values..
Really? Except I don't understand what you wanted. Am sure, hash would work perfectly, using the dataset you presented like so:
Which gives the following output:use warnings; use strict; 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 %line; for ( split /\n/, $file ) { my @datas = split; push @{ $line{ $datas[0] }{ $datas[1] } }, $datas[2]; } { $Data::Dumper::Sortkeys = 1; $Data::Dumper::Indent = 3; print Dumper \%line; }
So, one out of your questions, is actually done for you, the second one you can easily do. :)!$VAR1 = { '1.00' => { 'InDev' => [ #0 '01-Jun-2013' ], 'InProd' => [ #0 '15-Sep-2013' ], 'InTest' => [ #0 '15-Jul-2013' ], 'InUAT' => [ #0 '31-Jul-2013' ] }, '1.01' => { 'InDev' => [ #0 '01-Jul-2013' ] }, '2.00' => { 'InDev' => [ #0 '01-Aug-2013' ] }, '3.00' => { 'InDev' => [ #0 '01-Sep-2013' ] } };
In reply to Re: Dynamically build a table
by 2teez
in thread Dynamically build a table
by Deep_Plaid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |