http://www.perlmonks.org?node_id=125706


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

Bravo! (Just what I was thinking).

However, as an alternative to using no warnings 'uninitialized' (always appear as though you thought of everything), try OR-ing the hash values with 0, like this:

my %time=reverse split(/([HMS])/, '5H3M17S'); my $time = (( (($time{H}||0) * 60) + ($time{M}||0)) * 60) + ($time{S}| +|0);

dmm