Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Syntax error when trying to use a hash value as a file stream specifier

by BillKSmith (Monsignor)
on Sep 03, 2022 at 18:41 UTC ( [id://11146666]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Syntax error when trying to use a hash value as a file stream specifier
in thread Syntax error when trying to use a hash value as a file stream specifier

Good point! The function select acts as if it controls an anonymous global variable. That 'variable' has all the advantages and disadvantages of any global variable except that we cannot examine it. In your example, we all expect say to output to stdout. It is easy to forget that it may not be true.

Until the documentation for say is corrected, the victim of this bug could certainly claim that the bug is in perl, not his code.

Bill

Replies are listed 'Best First'.
Re^4: Syntax error when trying to use a hash value as a file stream specifier
by choroba (Cardinal) on Sep 04, 2022 at 18:06 UTC
    > we cannot examine it

    Of course we can:

    if (select eq 'main::STDERR') {

    > Until the documentation for say is corrected

    Done.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found