http://qs321.pair.com?node_id=11110728


in reply to How to calculate if today is before May 1

You could use the Time::Piece module which has been in the core Perl distribution since 5.10 I believe.

johngg@shiraz:~/perl/Monks$ perl -Mstrict -Mwarnings -MTime::Piece -E +' my $now = localtime(); my $may = Time::Piece->strptime( qq{@{ [ $now->year() ] }/05/01 00:00: +00}, q{%Y/%m/%d %T} ); say $now->epoch() < $may->epoch() ? q{Before 1st May} : q{After 1st May};' After 1st May

I hope this is helpful.

Update:The "false" part of the ternary would more accurately say "On or after 1st May" being pedantic.

Cheers,

JohnGG