Re: pie multiline replace

[email protected] (Rob Dixon)
Newsgroups perl.beginners
Message-ID <[email protected]>
bill lam wrote:
> Thomas Bätzler wrote:
>> perl -i -ple '$_ = "cc\n$_" if $p =~ m/aa/ && m/bb/; $p=$_'
> 
> Thanks. looks non-trivial for me. Anyway I will copy this idiom into my cheat sheet.
> 
> Thank Gunnar for suggestion too. However I prefer one-liner.

If you think the one-liner is non-trivial then all the more reason that you
should use a proper script. It is a bad idea to use any code unless you
understand why and how it works.

Rob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.