in reply to Regex and leading zeros in numbers
It always helps to read a little documentation before charging too deeply into new things! :)
While the 'don't use regexes' comments are 100% right, a regex cleanup solution could look something like $x=~s/[0]?(\d+)/$1/;. The question mark means 'optional', and the '+' means 'one or more of'. The $1 represents what you matched inside parens between the first set of slashes. So we are replacing digits with a leading zero with just the digits.
Again, read the docs, they are excellent. (as usual, all code is untested)
|
|---|