Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Why is the error thrown from close(FH) when the error is the missing <> on while(FH)?

by Anonymous Monk
on Feb 01, 2013 at 03:28 UTC ( #1016434=note: print w/ replies, xml ) Need Help??


in reply to Why is the error thrown from close(FH) when the error is the missing <> on while(FH)?

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.


Comment on Re: Why is the error thrown from close(FH) when the error is the missing <> on while(FH)?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016434]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2014-09-30 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (383 votes), past polls