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

Re^2: Filehandle/array naming

by choroba (Archbishop)
on Nov 20, 2020 at 11:38 UTC ( #11123888=note: print w/replies, xml ) Need Help??

in reply to Re: Filehandle/array naming
in thread Filehandle/array naming

This won't work, unfotunately. See perlop:

> If what's within the angle brackets is neither a filehandle nor a simple scalar variable containing a filehandle name, typeglob, or typeglob reference, it is interpreted as a filename pattern to be globbed, and either a list of filenames or the next filename in the list is returned, depending on context. This distinction is determined on syntactic grounds alone. That means <$x> is always a readline() from an indirect handle, but <$hash{key}> is always a glob(). That's because $x is a simple scalar variable, but $hash{key} is not--it's a hash element. Even <$x > (note the extra space) is treated as glob("$x "), not readline($x).

So, use readline, not the diamond.

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

Replies are listed 'Best First'.
Re^3: Filehandle/array naming
by bliako (Prior) on Nov 20, 2020 at 12:57 UTC

    A clarification is needed: if $x is a "simple scalar variable", then what is ${fh.$FILE}?

      A symbolic reference?

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

        I was under the impression that in this case brackets around a variable name are just to clarify things and $x was a synonym to ${x}. Is ${x.$y} a special case? calls that a not-so-symbolic reference! Tomorrow I will post a question as I am still confused on the boundaries.


Re^3: Filehandle/array naming
by JSAWS (Initiate) on Nov 20, 2020 at 11:58 UTC
    Thx a Million Choroba, that solved it!!!!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2021-01-20 21:32 GMT
Find Nodes?
    Voting Booth?