in reply to There has got to be a Cleaner Way!

Have a look at Tie::File (including its autochomping and locking).

— Arien