in reply to Re: putting dates int year, month date
in thread putting dates int year, month date

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.

Replies are listed 'Best First'.
Re^3: putting dates int year, month date
by Skeeve (Parson) on Oct 18, 2005 at 12:13 UTC
    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?

Re^3: putting dates int year, month date
by fishbot_v2 (Chaplain) on Oct 18, 2005 at 12:16 UTC

    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.