Still struggling with multilevel hashes. Below is my code snippet, obligatory
use statments are in effect. I don't understand the error. Line 52 refers
to the line %hrLists assignment -
Where did I go wrong?
Thanks,
deb
while (<DATA>) {
chomp;
($listname, $field) = split(/:/, $_);
print "\nListname is $listname,\nField is: $field\n";
%hrLists = split(/\s+/, $field);
$Lists{$listname} = \%hrLists;
}
__DATA__
list-1: -x abc -r tenb
list-2: -x def -r ghi -h tenr
list-3: -x fel -h asci
list-4: -x foo -h nonasci -r bfab
I'm getting this output:
Listname is list-1,
Field is: -x abc -r tenb
Odd number of elements in hash assignment at testhash2.pl line 52, <DATA> line 1.
Listname is list-2,
Field is: -x def -r ghi -h tenr
Odd number of elements in hash assignment at testhash2.pl line 52, <DATA> line 2.
Listname is list-3,
Field is: -x fel -h asci
Odd number of elements in hash assignment at testhash2.pl line 52, <DATA> line 3.
Listname is list-4,
Field is: -x foo -h nonasci -r bfab
Odd number of elements in hash assignment at testhash2.pl line 52, <DATA> line 4.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]