http://qs1969.pair.com?node_id=1022417


in reply to Find pieces of text in a file enclosed by `@` and replace the inside

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