$N =~ tr|[0-9]||cd;
NB: The first field of the tr/// operator (see Quote-Like Operators in perlop) is a search list, and it does not "know" about [...] character classes (the search list is itself a kind of character class), so the [ ] characters are among the "digit" characters which are not deleted.
Don't know about the rest of the question.c:\@Work\Perl\monks>perl -wMstrict -le "my $n = 'abc[]1p2q3][xyz'; $n =~ tr|[0-9]||cd; print qq{'$n'}; " '[]123]['
Give a man a fish: <%-{-{-{-<
In reply to Re: Converting to number doesn't always work...
by AnomalousMonk
in thread Converting to number doesn't always work...
by harangzsolt33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |