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


in reply to Re: Stuck in komplexer regex, at least for me
in thread Stuck in komplexer regex, at least for me

(for the regex fanboys:
sub compress_numstring { substr($_[0], 2) =~ s/(^0+|(0)0+|(?<!0)0([1-9]|$))/$2$3/; return $_[0]; }

does the same thing as the other function, but with more job security)
Unfortunately, 'use warnings' will complain.