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


in reply to RE: (2) One for the regexp fans (nnnn:nnnn:nnnn)
in thread One for the regexp fans

You could probably do something like:
if $str =~ m!\.! {$str =~ s/(\.?[0-9a-eA-E]*)/(substr("0$1", -2))/ge;} else {$str =~ s/(:?[0-9a-eA-E]*)/(substr("0$1", -4))/ge;}

Nuance