On Aug 27, 2012, at 9:30 PM, lina wrote:

> Hi,
> 
> I don't know which is the best way to "check whether this file is open
> or not,"

In general, you don't have to worry about it, because:

1. If a file handle goes out of scope, the file will be closed.

2. If you reuse a file handle that is open by opening another file, the first 
open file will be closed.

3. You can try to close the file handle regardless of whether it is open or not 
and ignore any error that the close returns.

4. If you really need to know, check out the eof function (perldoc -f eof).


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to