use strict;
$_ = "010";
s/^0+([1-9]|0$)/\1/;
print; # 10

$_ = "010";
s/^0+([0-9])/\1/;
print; # 10