Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The output I get is,open my $fh, '<', 'an_unlikely_file' or print "Not opened\n"; if ($fh) { print "But $fh evaluates to true\n" }
This may not be unexpected, but it doesn't agree with my intuition from C, where filehandles are NULL when fopen fails. Could someone share their insights about this behavior in Perl?Not opened But GLOB(0x183f070) evaluates to true
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filehandles when Open Fails
by jasonk (Parson) on Jul 25, 2007 at 14:44 UTC | |
|
Re: Filehandles when Open Fails
by cdarke (Prior) on Jul 25, 2007 at 15:06 UTC | |
|
Re: Filehandles when Open Fails
by Joost (Canon) on Jul 25, 2007 at 21:09 UTC |