Sounds like the dates are in the yyyy/mm/dd format, so why not just compare the strings with lt/gt?
sub validate_date { my ($start_date, $end_date, $today) = @_; return "Invalid format for start date (expecting yyyy/mm/dd)" if $start_date !~ m{^\d{4}/\d{2}/\d{2}\z}; return "Invalid format for end date (expecting yyyy/mm/dd)" if $end_date !~ m{^\d{4}/\d{2}/\d{2}\z}; return "End date must be no later than today" if $end_date gt $today; return "Start date must be no later than end date" if $start_date gt $end_date; return ""; }
In reply to Re: if && condition not working
by ikegami
in thread if && condition not working
by rakheek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |