pearlgirl has asked for the wisdom of the Perl Monks concerning the following question:
So all potential hashes will be generated in this format. I tried the following:[ {fruit=>apple, vegetable=> pumpkin, }, {fruit=>mango, vegetable=> tomatoes, }, {fruit=>strawberry, vegetable=> pumpkin, }, ]
I know the syntax is wrong, but it illustrates the idea of what I want to do. Have been googling all over the place, can't find anything. :/ Any guidance would be much appreciated. Thank youmy $arrayHash1 =(); my $arrayHash2 =(); my $arrayHash3 =(); my $FinalMegaHash =(); if ( condition1==true){ generate arrayHash1; $FinalMegaHash .= $arrayHash1; } if ( condition2==true){ generate arrayHash2; $FinalMegaHash .= $arrayHash2; } if ( condition3==true){ generate arrayHash3; $FinalMegaHash .= $arrayHash3; } print Dumper $FinalMegaHash;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: combining 3 arrays of hashes
by johngg (Canon) on Aug 19, 2016 at 19:57 UTC | |
by pearlgirl (Novice) on Aug 19, 2016 at 21:21 UTC |