in reply to putting dates int year, month date

Why not store each date in a HoHoA?
Example
%dates= ( 2004 => { 11 => [ 14, 15, 16 ], 12 => [ 1, 2 ], }, 2005 => { 1 => [ 4, 5, 6 ], 2 => [ 18, 20 ], }, );
So simply pump your dates into this structur, write 3 loops to print that structure and you're done.

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^2: putting dates int year, month date
by Anonymous Monk on Oct 18, 2005 at 12:07 UTC
    But it's exactly that structure that I'm trying to get from the original @intersect.

    Having sorted which dates belong to a particular year, I was trying to attach the months to the year then the days to the month. The structure that you identify seems the way to go but I don't see how to achieve it.

    Thanks for your advice.
      That's fairly easy:
      # Pseudocode! foreach $date (@dates) { split $date into $year,$month,$day push(@{$dates{$year}->{$month}}, $day); }

      s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
      +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
        Jees - I had a go with that - it's so powerful it nearly knocked my socks off!!

        Is there any way to slow it down so I can see what's going on?

      What about just:

      my %dates; for ( @intersect ) { my ( $year, $month, $day ) = Add_Delta_Days( 1, 1, 1, $_ - 1 ); push @{ $dates{$year}->{$month} }, $day; }

      Then you just have to sort the days.

      Update: Looks like Skeeve beat me to it. Nevermind.