in reply to Why? (each...)
$ perl -Mdiagnostics -e 'my %keys={A=>"b"};my ($a,$b); while (($a,$b)= +each %keys) { print "$a $b\n"; }' Reference found where even-sized list expected at -e line 1 (#1) (W misc) You gave a single reference where Perl was expecting a li +st with an even number of elements (for assignment to a hash). This u +sually means that you used the anon hash constructor when you meant to us +e parens. In any case, a hash requires key/value 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 Use of uninitialized value in concatenation (.) or string at -e line 1 + (#2) (W uninitialized) An undefined value was used as if it were alread +y defined. It was interpreted as a "" or a 0, but maybe it was a mi +stake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl tells you what ope +ration you used the undefined value in. Note, however, that perl optimiz +es your program and the operation displayed in the warning may not necessa +rily appear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer +to the concatenation (.) operator, even though there is no . in your program. HASH(0x60b220)
|
|---|