The two lookups $ref->{$key} and $ref{$key} access two different variables. They are not interchangeable, and the -> is not optional.
$ref->{$key} looks up the $key key in the $ref hashref.
$ref{$key} looks up the $key key in the %ref hash.
In reply to Re^4: Assigning value through references
by Somni
in thread Assigning value through references
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |