Joseph Alotta wrote:

I have a hash of data:

%highest_level = ( 2001-10-14 => 152, 2002-01-15 => 163, 2003-03-13 => 210, 2004-08-07 => 307 );

I think you mean:


%highest_level = (
    '2001-10-14' => 152,
    '2002-01-15' => 163,
    '2003-03-13' => 210,
    '2004-08-07' => 307
);

because otherwise the dates will be interpreted as (eg) 2001 minus 10 minus 14 == 1977.

Bravo for using decent, civilised ISO dates and not those crazy little-endian dates (as favoured by silly Europeans) or ridiculous middle-endian dates (as favoured by silly .USians)!

And I am give some dates in between:

@dates = ( 2001-12-30, 2002-03-19);

Again, quote the dates.


Am I missing something or is this harder than it first appears?

Aside from the above you're missing the many and varied Date::* modules on CPAN which exist to make date and time handling, including comparisons like what you need, easy. I won't say which one to use cos that's a religious issue :-)


--
Lord Protector David Cantrell  |  http://www.cantrell.org.uk/david

Repent through spending

Reply via email to