No such thing as a small change | |
PerlMonks |
Re: Find pieces of text in a file enclosed by `@` and replace the insideby kcott (Archbishop) |
on Mar 08, 2013 at 13:32 UTC ( [id://1022417]=note: print w/replies, xml ) | Need Help?? |
G'day kluther, Rather than using all those substitutions, you can do a single transliteration. Here's a commandline example: $ perl -Mstrict -Mwarnings -Mutf8 -e ' binmode STDOUT => ":utf8"; while (<>) { s/@([^@]+)@/$_ = $1; y{abcABC}{абцАБЦ}; $_/eg; print; } ' @abc@ abc @ABC@ абц abc АБЦ cba @cba CBA@ cba цба ЦБА -- Ken
In Section
Seekers of Perl Wisdom
|
|