http://qs321.pair.com?node_id=168463


in reply to reading/writing line by line

I understood that your need is to read a file, line by line, and if the line is not blank, write the line to the output file. Did I understand that correctly?

My code snippet, as you have quoted above, will:


What part is not working as expected?

Update:
I admit, I missed the words:
"...specifically for finding and replacing all occurences of a string..."

Of course, you're right. ;-) That's what I get for answering a question while on the run to go home. ;-)
while(<IN_FILE>) s/from/to/g; print OUT_FILE; }

should do it.

Everything went worng, just as foreseen.