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


in reply to A Few Questions About IO::File

According to module documentation on IO::File on CPAN undef $fh closes the file automatically. In contrast to Python, in Perl there is more than one way to do it. So both of your options are valid.

getlines comes from IO::Handle and is safe in list context according to its documentation.

For every complex problem there is an answer that is clear, simple, and wrong. H. L. Mencken