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:
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;
}
Which gives the following output:
$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'
]
}
};
So, one out of your questions, is actually done for you, the second one you can easily do. :)!
*I hope the above helps. You can also take a look at
perldsc
* Update
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author
unknown to me