in reply to Re: Dereferencing hashrefs
in thread Dereferencing hashrefs
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.
|
|---|