Thanks,
sauoq. Agreed, using
$/ may be a little more obscure, but it is the type of record-based solution I was looking for. I wouldn't run into the newline problem since I first check to see whether the file needs the mod in the first place (although you suggested a much more concise way of performing that check in another reply, so thanks for that too!).
-P