Refactor file writing - information on our use of Perl and Perl modules