@intersect = qw~732341 732336 732314 732335 732333 732368 732325 732369 732334 732332 732312 732352 732353 732347 732322 732362 732331 732363 732326 732370 732320 732365 732349 732364 732356 732342 732328 732357 732319 732313 732361 732340 732338 732323 732367 732345 732327 732360 732337 732350 732358 732343 732355 732351 732346 732366 732339 732344 732371 732321 732359 732348 732354 732330 732329 732324~;

I am getting into a tangle trying extract the days, months and years from @intersect

I would like to achieve the following:
year1 month followed by list of days
          next month followed by list of days
year2 month followed by list of days

etcetera

I was working along the lines of:
my $pname; my @booked; my $daysb; my @yeara; my @yearb; foreach my $item (@intersect) { my ($year,$month,$day) = Add_Delta_Days(1,1,1, $item - 1); if ($year == $y) { push (@yeara, $item); } elsif ( $year == ($y + 1) ) { push (@yearb, $item); } else { print 'Sorry, the search period is too long - please go back a +nd try again'; exit; } } my %seen = (); my %cmyears; my %cmmonths; my @months_in_year = (); my @days_in_month = (); my %cmdays; my %yeara = (); @yeara = sort (@yeara); foreach my $item (@yeara) { my ($year,$month,$day) = Add_Delta_Days(1,1,1, $item - 1); $cmmonths{$item} = $month; push (@months_in_year, $month); } while ( my ($key, $value) = each (%cmmonths) ) { foreach my $item (@months_in_year) { if ($item == $value) { my ($year,$month,$day) = Add_Delta_Days(1,1,1, $key - 1); push (@days_in_month, $day); } } $cmdays{$key} = \@days_in_month; }
But I cannot extract myself from this morass, which is why I now seek your kind advice.

In reply to putting dates int year, month date by Anonymous Monk

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.