Your issue is that the ending :
in a first match is "eating" the beginning :
of the next match.
You could use zero width word boundary:
$this_video_duration =~ s/\b\d\b/0$&/g;
\b
will match between \w\W
or \W\w
, and \d
is in \w
. Demo here.