2008/4/29 John W. Krahn <krahnj@telus.net>:
> Perl seems to think that it is closed:
>
> $ perl -le'
> if ( open my $fh, "<", "/etc/passwd" ) {
> print "opened" if fileno $fh;
> }
> print "still opened" if fileno $fh;
> '
> opened
>
>
> If it were still opened then fileno() would return true.
You're not testing the right one.
$ perl -Mstrict -le'
if ( open my $fh, "<", "/etc/passwd" ) {
print "opened" if fileno $fh;
}
print "still opened" if fileno $fh;
'
Global symbol "$fh" requires explicit package name at -e line 5.
Thread Previous
|
Thread Next