Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Re: Dereferencing hashrefs

by Sweeper (Pilgrim)
on Feb 11, 2002 at 22:28 UTC ( [id://144725]=note: print w/replies, xml ) Need Help??


in reply to Re: Dereferencing hashrefs
in thread Dereferencing hashrefs

The {}s work like parenthesies. I've often wondered why {}s are used in this context, not ()s. Anybody?)

Perl was initially based on C, sh and awk. The syntax $foo is inherited from sh, and like in sh, there were some problems if the variable was followed by a string. So, like in sh, there is the alternate syntax ${foo}.

And then, there is the backward compatibility Perl 1 -> Perl 2 -> Perl 3 etc. This is why curlies have remained, and are still there.

There might be another reason. There is a special variable $( ($GID), so with $(foo), there would be some ambiguous parsing. There is no special variable consisting of a dollar and a single open curly, so parsing ${foo} not ambiguous.

Log In?
Username:
Password:

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

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

    No recent polls found