I would first take that date and split it into its components:
my ($month, $day, $year) = split /\//, $hash{Date};
I would then use some sort of logic or lookup table to decide if $month = 4 and $day = 15 is spring, summer, fall, or winter. Then once I had decided that, I would drop it all into place as described in my previous post.
But the more I think of it, the more I wonder if it's such a good idea to subdivide by season. It might be easier to work with if you make the season simply another element within the structure contained in the day. In other words,....
my $season = get_season( $month, $day );
$archive{2003}{4}{15} = ( High => $hash{High},
Low => $hash{Low},
Wind => $hash{Wind},
Bar => $hash{Bar},
Seas => $season );
You'll have to think through how to implement get_season().
This makes it easier to find dates without having to go through the mentally challenging exercise of figuring out what season that date falls in before you can find it again. If you ever prefer to sort by season by date, you can just write a sort routine to handle that need.
What made me first think of putting season as a field within the archive for that date is thinking back to my days as a retail buyer, where we dealt in two seasons per year, but advertised in four seasons. So it was always a mental exercise to remember that even though to me July is the beginning of the fall season, to the public July is summer, which isn't a season to a retailer.
Dave
"If I had my life to do over again, I'd be a plumber." -- Albert Einstein
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.