Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Dereference a reference to a file handle created with IO::File

by BillKSmith (Prior)
on Oct 28, 2020 at 02:17 UTC ( #11123246=note: print w/replies, xml ) Need Help??


in reply to Dereference a reference to a file handle created with IO::File

Refer print:
FILEHANDLE may be a scalar variable containing the name of or a reference to the filehandle,...

UPDATE: Changed emphasis per Tobyink (below)

Bill
  • Comment on Re: Dereference a reference to a file handle created with IO::File

Replies are listed 'Best First'.
Re^2: Dereference a reference to a file handle created with IO::File
by tobyink (Canon) on Oct 28, 2020 at 08:41 UTC

    Yeah, this is a place you need to pay careful attention to the wording. It has to be a scalar variable, not just a scalar.

    Like foo() could return a scalar, and that scalar could be a reference to a filehandle. But print foo() "string\n" will fail because even though foo() evaluates to a scalar, it's not a scalar variable. Nor is $foo{'somekey'}.

    Same as you're not allowed to do:

    my %foo; for $foo{'somekey'} ( @arr ) { ...; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2021-04-23 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?