in reply to remove characters by their codes
Some other monk will probably post a one-liner, but this should work, and hopefully it's easy to understand. If you don't know of them already, have a look at chr and quotemeta, and maybe ord for good measure.
my @ascii_be_gone = (215,220,224,226,231,232,233,234,235); my @chars_to_go = map { chr } @ascii_be_gone; my $pattern = join '|', map { quotemeta } @chars_to_go; $str =~ s{$pattern}{}g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: remove characters by their codes
by ikegami (Patriarch) on Dec 11, 2007 at 06:56 UTC |