in reply to Re: Remove non-numerics from string
in thread Remove non-numerics from string

It's a good idea to always check if a regex succeeds before using $1 and friends, or you may get a result from a previous match. One way to do this implicitly: ($newValue) = $oldValue =~ /_(\d+)\./; This leaves $newValue as undef on failure (because the match returns an empty list). You can even set newValue and check the result all at once: ($newValue) = $oldValue =~ /_(\d+)\./ or warn "bad format: '$oldValue'"; or
if (($newValue) = $oldValue =~ /_(\d+)\./) { # all is ok } else { # something went wrong }