in reply to strict filehandles?
danichka has already pointed out the thread I was about to link to, so I won't to that.
To summarize: strict does not protect filehandles, but you can use undefined scalars, that will be made references to anonymous globs.
That will barf. By the way, the "Where is this going???" isn't going anywhere in your example. Had you used warnings, the "print() on unopened filehandle" warning would have been emitted. And because print returns true on success and false on failure, you could have tried:use strict; open my $foo, 'whatever.file' or die $!; print $bar "Where is this going???"; close $foo;
Which would die "Bad file descriptor".print BAR "Where is this going???" or die $!;
Yes, I reinvent wheels.
|
|---|