http://www.perlmonks.org?node_id=1008065


in reply to error in printing output of Data::Dumper to file

Remember to close the file handle after writing.

Perl closes the file handle for you automatically at program exit, but if you try to re-read the file from the same process, or maybe kill your program, that might not happen, or too late.