See perlintro and perldsc maybe.
The idea is to initialize $data{ $master_key } with an empty array for each id and then to push every found element onto that array:
... $data{$master_key} ||= []; # if we haven't seen $master_key yet, creat +e a fresh array my %this_set; for my $col(1 .. $eSheet->{MaxCol}) { # Some logging for debugging if( !defined $eSheet->{Cells}[$row][$col]) { print "Row $row: skipping empty column $col\n"; next; }; my $key= $eSheet->{Cells}[0][$col]->Value; my $value = $eSheet->{Cells}[$row][$col]->Value; $this_set{$key}=$value; } } # Store our found set for that ID: push @{ $data{ $master_key }}, \%this_set;
In reply to Re^5: Converting Excel to Hash
by Corion
in thread Converting Excel to Hash
by ravi179
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |