Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 musing on the Monastery: (17)
As of 2015-07-01 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (19 votes), past polls