diff options
author | Tom Phoenix <rootbeer@teleport.com> | 1998-03-28 07:26:46 -0800 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-04-02 16:13:24 +0000 |
commit | 1930e9396af9d9fc0058435c827d67f591aa4e03 (patch) | |
tree | 24df53c731d9ac3f949f340ce1dc2e5257c423db /pod | |
parent | 8fde5078471a0c312457a335e09b9df2f722133e (diff) | |
download | perl-1930e9396af9d9fc0058435c827d67f591aa4e03.tar.gz |
Re: Odd number of elements in hash list.
p4raw-id: //depot/perl@858
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldiag.pod | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 77b714c9f2..96f5c671ea 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1711,10 +1711,10 @@ about 250 characters. You've exceeded that length. Future versions of Perl are likely to eliminate this arbitrary limitation. In the meantime, try using scientific notation (e.g. "1e6" instead of "1_000_000"). -=item Odd number of elements in hash list +=item Odd number of elements in hash assignment -(S) You specified an odd number of elements to a hash list, which is odd, -because hash lists come in key/value pairs. +(S) You specified an odd number of elements to initialize a hash, which +is odd, because hashes come in key/value pairs. =item Offset outside string @@ -2063,6 +2063,18 @@ which is why it's currently left out of your copy. (F) More than 100 levels of inheritance were used. Probably indicates an unintended loop in your inheritance hierarchy. +=item Reference found where even-sized list expected + +(W) You gave a single reference where Perl was expecting a list with +an even number of elements (for assignment to a hash). This +usually means that you used the anon hash constructor when you meant +to use parens. In any case, a hash requires key/value B<pairs>. + + %hash = { one => 1, two => 2, }; # WRONG + %hash = [ qw/ an anon array / ]; # WRONG + %hash = ( one => 1, two => 2, ); # right + %hash = qw( one 1 two 2 ); # also fine + =item Reference miscount in sv_replace() (W) The internal sv_replace() function was handed a new SV with a |