The difference is that Example 2 (using parentheses) is correct and the others are broken.
Braces (i.e. { and }) are used (amongst other things) to create hash references. So...
my %hash = ( foo => 1, bar => 2 ); my $hashref = { foo => 1, bar => 2 };
In reply to Re: Difference in Hash Declaration
by tobyink
in thread Difference in Hash Declaration
by perl@1983
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |