On Thu, Jan 6, 2011 at 12:25 PM, Chris Stinemetz <
cstinem...@cricketcommunications.com> wrote:

> 11.   %fieldMap = split(/;/, $data);
>
>
> 12.   foreach my $data (keys %fieldMap) {
>
> 13.   print "$fieldMap{$data}\t";
>
> 14.   }
>
> Odd number of elements in hash assignment at./beta2.pl line 15, <> line 1.
> Use of uninitialized value within %fieldMap in concatenation (.) or string
> at ./beta2.pl line 18, <> line 1.
>

Line 11 treats the result of "split" as a list of "key => value" pairs. You
end up with something like this...
$fieldMap{8} = 1023240136
$fieldMap{1218} = 0
$fieldMap{1} ="00a000001a2bcdc7"

Perl expects the data to have a value for every key. The first error - odd
number of elements - means that Perl saw a key without a corresponding
value. The data has an odd number of elements. To save into a hash, it
should have an even number of elements.

-- 
Robert Wohlfarth

Reply via email to