in reply to Re: When do filehandles close?
in thread When do filehandles close?

Missed one little thing;-) as the OP already pointed out, reopen implicitly close a file handler.

However in this case $. (current line number for the last filehandle accessed) is not reset. I would prefer explicit close all the time simply because of this.

Update

Just add a piece of code for demon (name this script a.pl):

use strict; use warnings; open(SCRIPT, "<", "a.pl"); <SCRIPT>; <SCRIPT>; print $., "\n"; #close(SCRIPT); open(SCRIPT, "<", "a.pl"); <SCRIPT>; print $., "\n";

Try to comment or uncomment that close. If it is commented, print out:

2 3

If it is not commented:

2 1