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

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

O dwellers of Perl, have I a mighty perplexing affair that causes me a grave despair. It is basically with regard to the different ways we read a file once it has been opened. I know that there's reading a file line wise or in bulk, that's via syntax similar to $line = <FH> or @lines = <FH> respectively, and that the second case might warrant undefing the variable $/ and then maybe splitting or doing array manipulation.

What I am confused about is when in a loop I have something like while(<FH>){...}, is this any different than $line=<FH> or are these granularly the same?

To delete a file we use unlink and to close a file handle we use close and then we have undef which can also close a filehandle for us, my heart tells me that using undef this way is somewhat frowned upon or sinful, is that justified?

While I feel I can handle files to some degree, I still find it difficult to summarize my knowledge with respect to the issue presented in this post, could ye wise ones steer forth to the podium and clarify these and thus thou shalt assist a needy knowledge-seeker.