Given the the file handle is actually is, error is coming from the condition for while ...
# cat p.pl ; perl p.pl use strict; open FH , '<' , $0 or die "open failed: $!"; while( FH ) { last; } close FH or die "close failed: $!"; __END__ Bareword "FH" not allowed while "strict subs" in use at p.pl line 11. Execution of p.pl aborted due to compilation errors
... despite the line number reported. open & close can deal with a bareword file handle but not loop condition.
In reply to Re: Why is the error thrown from close(FH) when the error is the missing <> on while(FH)?
by Anonymous Monk
in thread Why is the error thrown from close(FH) when the error is the missing <> on while(FH)?
by techgrrl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |