data67 has asked for the wisdom of the Perl Monks concerning the following question:
DESCRIPTION
Lets say my hash looks like this after i set it up:
%HoH = ( cat => { 'FY2003-Q2' => { 'this is the customers data => '1' }, 'FY2003-Q4' => { 'this is the customers data => '1' }, 'FY2004-Q1' => { 'this is the customers data => '1' }, 'FY2004-Q2' => { 'this is the customers data => '1' }, }, dog => { 'FY2003-Q2' => { 'this is the customers data => '1' }, 'FY2003-Q1' => { 'blah blah blah' => '1' }, }, catdog => { 'FY2004-Q1' => { 'blah blah blah' => '1' }, 'FY2004-Q2' => { 'blah blah blah' => '1' } } );
my %date_slots = ( 1 => FY2003-Q2, 2 => FY2003-Q3, 3 => FY2003-Q4, 4 => FY2004-Q1, 5 => FY2004-Q2 );
This prints what ever is in my HoH hash.foreach $customer (keys %HoH) { print "$customer\n"; foreach $date (keys %{$HoH{$customer}} ) { print "\t\t$date"; foreach my $data (keys %{$cal{$customer}{$date}} ) { print " = $data\n"; } } }
But my goal is to take the %date_slots hash and match my HoH datacat FY2003-Q2 = blah blah blah FY2003-Q4 = blah blah blah FY2004-Q1 = blah blah blah FY2004-Q2 = blah blah blah dog FY2003-Q1 = blah blah blah FY2003-Q2 = blah blah blah catdog FY2004-Q1 = blah blah blah FY2004-Q2 = blah blah blah
cat FY2003-Q2 = blah blah blah FY2003-Q3 = no data FY2003-Q4 = blah blah blah FY2004-Q1 = blah blah blah FY2004-Q2 = blah blah blah dog FY2003-Q2 = blah blah blah FY2003-Q3 = no data FY2003-Q4 = no data FY2004-Q1 = no data FY2004-Q2 = no data catdog FY2003-Q2 = no data FY2003-Q3 = no data FY2003-Q4 = no data FY2004-Q1 = blah blah blah FY2004-Q2 = blah blah blah
Sorry for the lousy explanation, and thanks for your help.
"Learning is a treasure
that will follow its owner everywhere."
-Chinese proverb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mix and Match Hashes
by hiseldl (Priest) on Oct 03, 2002 at 16:57 UTC | |
|
Re: Mix and Match Hashes
by Tanalis (Curate) on Oct 03, 2002 at 17:02 UTC | |
|
Re: Mix and Match Hashes
by zigdon (Deacon) on Oct 03, 2002 at 16:55 UTC |