vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:
Today I was learning about the FileHandle module from CPAN, they have given the example like how to use
use FileHandle; $fh = new FileHandle "file", "r"; if (defined $fh) { print <$fh>; undef $fh; # automatically closes the file }
In this example they used 'undef' to close the named file handle, I changed the 'undef' as 'close' it works fine, whether undef and close are identical here ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: FileHandle: undef vs close
by lostjimmy (Chaplain) on Apr 30, 2009 at 14:16 UTC | |
by Utilitarian (Vicar) on Apr 30, 2009 at 15:20 UTC | |
by chromatic (Archbishop) on Apr 30, 2009 at 17:59 UTC | |
by vinoth.ree (Monsignor) on Apr 30, 2009 at 14:31 UTC | |
|
Re: FileHandle: undef vs close
by JavaFan (Canon) on Apr 30, 2009 at 16:08 UTC | |
|
Re: FileHandle: undef vs close
by Corion (Patriarch) on Apr 30, 2009 at 14:13 UTC | |
|
Re: FileHandle: undef vs close
by Crackers2 (Parson) on Apr 30, 2009 at 18:03 UTC |