use warnings; use strict; my $s = 'foo bar {}{}'; $s =~ s/(.)/(ord($1) > 122) ? sprintf '\\x%x', ord($1) : $1/ge; print "$s\n"; __END__ foo bar \x7b\x7d\x7b\x7d
In reply to Re: How to replace extended ascii ctrs with \xnn strings?
by toolic
in thread How to replace extended ascii ctrs with \xnn strings?
by bulrush
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |