in reply to arrays, hashes, dereferencing confusion - need help

When Perl tells you a line number in an error, it often helps to look at that line:

Odd number of elements in anonymous hash at arrayTest_monk.pl line 38.
%resultHash = {$deRefHashArray[$counter]};

To me it seems as if you wanted to write

%resultHash = <b>%</b>{$deRefHashArray[$counter]};

Replies are listed 'Best First'.
Re^2: arrays, hashes, dereferencing confusion - need help
by Klunk (Novice) on Mar 20, 2010 at 10:01 UTC
    I did look at the line - I just didn't know what to do about what it said!

    Easy when you know how, eh?

    Thanks!

      Its also easy when you don't know :)

      perl -Mdiagnostics -le "my %foo = 1 "

      Odd number of elements in hash assignment at -e line 1 (#1)
      (W misc) You specified an odd number of elements to initialize a hash, which is odd, because hashes come in key/value pairs.