And just to be different:(my $secs = "5H3M17S") =~ s/((\d+)H)?((\d+)M)?((\d+)S)?/3600*$1 + 60*$ +3 + $5/e;
use strict; my $time = "5H3M17S"; my $secs = 0; my $exponent = 0; map { $secs += $_ * 60 ** $exponent++ } reverse(split(/[HMS]/, $time)) +;
-Matt
In reply to Re: Re: Time to seconds
by DrManhattan
in thread Time to seconds
by argus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |