From: Philip Potter <philip.g.pot...@gmail.com>
> Dear all,
> 
> I'm trying to learn to use the IO::File object as a means of passing a
> filehandle from one function to another. In the perldoc documentation
> for IO::File, it gives the example:
> 
> undef $fh;       # automatically closes the file
> 
> but in the reference that follows, it gives no indication for why this
> might be the case. Would this behaviour be caused by the destructor?

Yes

> If $fh goes out of scope, will the file be automatically closed?

Yes

And you do not have to go all OO to make use of this.

 open my $FH, '<', $filename or die;

creates such an object as well.

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
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