perl -le '@times=qw(5:29,11 29,11 29 ,11 5:29 abc); foreach my $time (@times){ if($time!~/[0-9:,]+/) {$seconds=-1} else { ($seconds=$time)=~s{^(?:(\d+):)?(\d+)?(?:,(\d+))?$}{$1*60+$2+$3 +/10**2}e;} print $seconds}' 329.11 29.11 29 0.11 329 -1
In reply to Re: Convert time string to seconds
by suhailck
in thread Convert time string to seconds
by Dirk80
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |