in reply to Re: Why? (each...)
in thread Why? (each...)
Then you have a broken Perl.
$ perl -e'use warnings; my %keys={A=>"b"};' Reference found where even-sized list expected at -e line 1. $ perl -v This is perl, v5.10.0 built for i686-linux Copyr...
I still am fuzzy about the difference between “square brackets,” “braces,” and “parentheses.”
Square brackets create an array and return a reference to the array.
Curly brackets create a hash and return a reference to the hash.
Parens are like in Math. They change the order of operations.
From that, it follows that one never uses [] or {} when initialising an array or hash*, and that parenthesis aren't related to array or hash initialisation.
* — They might be used in initialising the value of an array or hash element's value, though.
Update: I added the last paragraph and the associated "*". I thought it was obvious, especially in the context of the other replies, but it might need saying.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Why? (each...)
by Argel (Prior) on May 12, 2011 at 19:01 UTC | |
by ikegami (Patriarch) on May 12, 2011 at 19:47 UTC | |
by Argel (Prior) on May 12, 2011 at 23:15 UTC | |
by ikegami (Patriarch) on May 12, 2011 at 23:53 UTC | |
by LanX (Saint) on May 13, 2011 at 00:06 UTC | |
|