Perl: Loop through a file and substitute

file, perl, substitution

Solution

I normally code up a one liner for this:

perl -i -pe 's/some/thing/' log.file

See Here

Problem

I simply wanna read in a logfile, do a search and replace, and then write out the changes to that same logfile. What's the best practice way of doing this in Perl?

Original source