jck has asked for the wisdom of the Perl Monks concerning the following question:
i am reading records from a database (MS-Access, unfortunately) on a Win2000 server, where the records have responses from judges ($j_name) who have scored three elements($mentor, $ptcare,$clinres) of a nomination($n_name). I want to generate a report of all the scores submitted by each judge for multiple nominees, so an array in a hash of arrays seemed like the logical way to go. It works fine if i comment out line 52 (i get the expected hash of arrays, showing which nominees were judged by which judges), but when i add back line 52, I get the above error "Can't coerce array into hash....at line 52". i've also tried using the syntax: "$judge{$j_name}->{Nominee}->{Scores} = [$mentor,$ptcare,$clinres]; " with the same error. i'm sure i'm making some kind of dereferencing error, i just can't see it. TIA for your kind and patient help!
40 my %judge = (); 41 while ($db->FetchRow()) { 42 my $n_name = $db->Data("NOMNAME"); 43 my $mentor = $db->Data("MENTOR"); 44 my $ptcare = $db->Data("PTCARE"); 45 my $clinres = $db->Data("CLINRES"); 46 my $j_name = $db->Data("JUDGENAME"); 47 my $j_inst = $db->Data("JUDGEINST"); 48 print "<p>$j_name, $j_inst, $n_name</p>"; 49 $judge{$j_name} = {JudgeInst => $j_inst} 50 unless exists $judge{$j_name}; 51 push @{$judge{$j_name}->{Nominee}}, $n_name; 52 push @{$judge{$j_name}->{Nominee}->{Scores}}, + $mentor,$ptcare,$clinres; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't coerce array into hash
by seaver (Pilgrim) on Sep 24, 2003 at 15:17 UTC | |
by Anonymous Monk on Sep 24, 2003 at 17:37 UTC | |
|
Re: Can't coerce array into hash
by rdfield (Priest) on Sep 24, 2003 at 15:10 UTC |