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]