in reply to read from a file and write into the same file
Remember you can also use perl to edit files in-place.
Now I have a question for the more experienced Perlers, can I do in-place file substitution from inside a script using just Perl code. Or do I have to execute as a command line? I know I can execute a command line within a Perl script, but what I mean, can I do it otherwise, without going to the command line in any way?
The above command will append a new line containing **************** after every line in the document.> perl -p -i.bak -e "s/(.*)/$1\n****************/" test.txt
Now I have a question for the more experienced Perlers, can I do in-place file substitution from inside a script using just Perl code. Or do I have to execute as a command line? I know I can execute a command line within a Perl script, but what I mean, can I do it otherwise, without going to the command line in any way?
In Section
Seekers of Perl Wisdom