UPDATE: Sound enough code (and can be adapted (below) to OP's needs), but NOT a complete answer to OP's question, which I mis-read.
Use the inverse of your regex, namely:
$string=~ s/\d//g;
like this without having to add additional tests to deal with strings which have no numbers:
C:\>perl -E "my $string=('data12.csv');$string=~ s/\d//g;say $string; data.csv C:\>perl -E "my $string=('data.csv');$string=~ s/\d//g;say $string;" data.csv
In reply to Re: How to remove non-numbers from string
by ww
in thread How to remove non-numbers from string
by kgherman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |