http://www.perlmonks.org?node_id=431292

Tuppence has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

Having already replaced every \n in my source tree with \266 due to a bad command line, I need help with what I expected to be very simple.

I'm trying to run a multi-line search replace against a file from the command line.

Simplified, I want

perl -pi -e 's/(.*)/{\1}/gs' filename.txt

to put a { } wrapper around the entire file. Instead, it puts a { } wrapper around each line. (and some weird extra ones, but eh whatever)

I thought this could be solved with something like -l0666, but I can't find why I think that and it already toasted my code tree once...

Tuppence