http://qs321.pair.com?node_id=977633


in reply to Mini-Tutorial: Dereferencing Syntax

Not mentioned:   $$foo as shorthand for $foo->.
  • Comment on Re: Mini-Tutorial: Dereferencing Syntax

Replies are listed 'Best First'.
Re^2: Mini-Tutorial: Dereferencing Syntax
by ikegami (Patriarch) on Sep 17, 2012 at 05:03 UTC

    $$foo is not a shorthand for $foo->.

    >perl -E"$foo=\'foo'; say $$foo;" foo >perl -E"$foo=\'foo'; say $foo->;" syntax error at -e line 1, near "->;" Execution of -e aborted due to compilation errors.

    You're probably thinking of the equivalency of $$foo[...] and $foo->[...] and of $$foo{...} and $foo->{...}, but that's already mentioned.