use File::Util; my $ftl = File::Util->new(); # write to a file: (It is automatically locked) $ftl->write_file(file => '/foo/bar/baz.txt', content => 'blah blah blah'); # read from a file: (It is automatically locked) my $content = $ftl->load_file("/foo/bar/baz.txt"); # to get an open filehandle that is automatically locked, # see http://search.cpan.org/~tommy/File-Util-3.30_003/Util.pod#open_handle