Try iterating over %date_slots and printing the customer data || 'no data'; Example:

#!perl -w %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', ); foreach $customer (keys %HoH) { print "$customer\n"; foreach $slot (sort keys %date_slots) { $date = $date_slots{$slot}; print "\t\t$date = "; ($key, $val) = each %{$HoH{$customer}{$date}}; print $key || "no data"; print "\n"; } # foreach $date (keys %{$HoH{$customer}} ) { # print "\t\t$date"; # foreach my $data (keys %{$cal{$customer}{$date}} ) { # print " = $data\n"; # } # } } __END__ # my results: cat FY2003-Q2 = this is the customers data FY2003-Q3 = no data FY2003-Q4 = this is the customers data FY2004-Q1 = this is the customers data FY2004-Q2 = this is the customers data dog FY2003-Q2 = this is the customers data 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

Note: I had to fix up your %HoH and %date_slots hashes because they were missing ending quotes.

--
hiseldl
What time is it? It's Camel Time!


In reply to Re: Mix and Match Hashes by hiseldl
in thread Mix and Match Hashes by data67

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.