Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Error coming while using Use Strict

by JavaFan (Canon)
on Oct 13, 2011 at 10:54 UTC ( [id://931194]=note: print w/replies, xml ) Need Help??


in reply to Error coming while using Use Strict

The problem is that the first argument of open should either be a filehandle, or a reference to a filehandle. Since 5.6, open will autovivify an undefined value into a filehandle (most people say "since 5.6, we have lexical filehandles". That's not true. Neither is the first argument of open a filehandle in this case, nor is 5.6 a requirement to have a lexical reference to a filehandle. Both have been possible long before 5.6 - it's only the autovivification that's new). But you're passing in a variable with a defined value; that's fine, Perl will try to use it as a reference to a filehandle. And the *1 typeglob does have a slot for filehandles. It will all work fine and dandy, except that by enabling strict 'refs', you're explicitely forbidden Perl to do its utter best to satisfy your request.

If you'd just replace $filehandle=$val; with my $filehandle;, it should all work.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-25 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found