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

Re^2: blocks and using braces around filehandles with print

by nefigah (Monk)
on Mar 16, 2008 at 05:16 UTC ( #674427=note: print w/ replies, xml ) Need Help??


in reply to Re: blocks and using braces around filehandles with print
in thread blocks and using braces around filehandles with print

(Not my question, but thought I'd jump in:)

So the rules here are the same as whether or not you need curlies for dereferencing an array (etc.)? e.g. @$arrayref but @{ $arrayrefs[0] } ?


I'm a peripheral visionary... I can see into the future, but just way off to the side.


Comment on Re^2: blocks and using braces around filehandles with print
Select or Download Code
Re^3: blocks and using braces around filehandles with print
by ikegami (Pope) on Mar 16, 2008 at 05:27 UTC
    There really isn't any connection between those two kinds of curlies. Those of which you speak act like parens to modify precedence and are solely used in dereferencing.
    $$array[0] # Short for ${ $array }[0] ${ $array }[0] # The first element of the array referenced by $array ${ $array[0] } # The scalar referenced by the first element of @array

    A third, similar type of curlies is used in interpolation to show where the variable name ends.

    "foo$varbar" # Equivalent to "foo" . $varbar "foo${var}bar" # Equivalent to "foo" . $var . "bar"

      Ah, okay. Thank you :)

      Sorry for the slight hijack!


      I'm a peripheral visionary... I can see into the future, but just way off to the side.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2014-04-24 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (565 votes), past polls