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


in reply to One for the regexp fans

try this:
$str =~ s/(.[^\.]*)(\.?)/(substr("0" x 2 .$1, -2)).$2/ge;


/Maqs.