in reply to Re: Writing to files
in thread Writing to files
Unfortunately, this doesn't work, because the BEGIN occurs
before STDOUT is redirected to the output file (the file
you're writing to). Plus, in your case, you used single
quotes to surround your "\n", so it didn't get interpolated.
Here's what I get:
I tried this myself, the other day, but ran into the same problem.% perl -i -p -e "BEGIN{print 'A new line!\n';}" foo A new line!\n%
|
---|
In Section
Seekers of Perl Wisdom