$timestr =~ /^(?:(\d+)H)?(?:(\d)+M)?(\d+)S$/;with
$timestr =~ /^(?:(?:(\d+)H)?(\d)+M)?(\d+)S$/;.
The difference is that the first will accept 10H5S, while the second won't. (And you'll be testing that the match succeeds in real code, of course).
In reply to Re: Re: Time to seconds
by ariels
in thread Time to seconds
by argus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |