in reply to Re^3: unquoted string error??!!
in thread unquoted string error??!!
Did you somehow expect something else? Perl gives you the tools to diagnose and debug such buggery. Do not blame Perl if you ignore its prudent advice.% perl -Mautodie /tmp/buggy Name "main::OUTPUT_FILE" used only once: possible typo at /tmp/buggy l +ine 16. Can't close filehandle 'OUTPUT_FH': 'Bad file descriptor' at /tmp/bugg +y line 19
use vars qw($fh); undef $fh; open($fh, "> /tmp/data.$$") || die "can't open /tmp/data.$$: $!"); print $fh "I am so NOT a lexical filehandle.\n"; close($fh) || die "can't close /tmp/data.$$: $!";
my $fh = *STDOUT; print $fh "I am SO TOO lexical filehandle.\n";
I therefore submit that the thing you are talking about is not “lexical filehandles”, and to call them what they are not is to risk introduction of bugs in one’s mental model.
I believe what you are referring to is not “lexical handles”, but instead autovivified anonymous handles, which may — or may not —happen to be stored in lexical variables.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: unquoted string error??!!
by runrig (Abbot) on May 04, 2011 at 18:05 UTC | |
by JavaFan (Canon) on May 05, 2011 at 11:16 UTC | |
by tchrist (Pilgrim) on May 04, 2011 at 18:16 UTC | |
by runrig (Abbot) on May 04, 2011 at 22:23 UTC | |
by tchrist (Pilgrim) on May 04, 2011 at 22:58 UTC | |
by Anonymous Monk on May 04, 2011 at 23:44 UTC |