s/(\d+)/sprintf("%013d", $1)/eg #### s/(\d+)/reverse(sprintf("%013d", scalar(reverse($1))))/eg;