Dear Monks,
If I have a string in perl, say 'data12.csv', I know I can remove the nun-numbers by using
#!/usr/bin/perl my $string=('data12.csv'); $string=~ s/\D//g; print "$string\n";
which returns 12. However, when I get a string 'data.csv' the previous lines of code return, not surprisingly, nothing. How can I tell perl to return, in such case, 0?
In reply to How to remove non-numbers from string by kgherman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |