in reply to need regular expression

Hi,

Try this...

$_='4-10-31';

print $_ if (s/(\d{1,2})(\-\d{1,2}\-\d{1,2})/"2". 0 x (4 - length($1)+1-2).$1.$2/e);

frank.