We don't bite newbies here... much | |
PerlMonks |
Re^3: in place editing a list of filesby liverpole (Monsignor) |
on Jan 08, 2007 at 18:45 UTC ( [id://593596]=note: print w/replies, xml ) | Need Help?? |
Hi rjsaulakh,
As ysth pointed out, my code was not doing the in-place editing part, nor the multi-line edit. But those are quite easy to do. Here's a modified example that should work for you. Notice that the datafile can contain blank lines or commented-out lines, which are skipped (eg. # testfile). Notice, too, that the input file, once it's read and processed, is being written to, so it's REALLY an in-place edit. Warning: Since it's doing in-place edits, be careful to have a backup copy of any files that you need to keep the original of! Here's the code:
I made the file-processing into a subroutine for clarity, but you could do it within the loop if you wanted to, naturally. s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
In Section
Seekers of Perl Wisdom
|
|