in reply to Re: Time to seconds
in thread Time to seconds

That's a very nice, robust, solution.

For an error, here are two suggestions: return undef, or throw an exception.

You can even "use warnings" to specify which you want.

For a totally different approach, which doesn't apply well to this format, one time in a date thing I used July 4 1776 as an error return code. A famous date is easy to recognise as not a random (e.g. bad arithmetic or stray pointer) but still outside the expected range.

—John