Hi,
please forgive if this is a very newbie question. I have course data returned from DB by something like:
$sql = qq{select course_id,course_name,course_sitting_id,course_sittin +g_date from courses}; $sth = $dbh->prepare($sql) or die . . .; $sth->execute() or die . . . .; while (@fetch = $sth->fetchrow) { . . . .
Which returns data like :
10,Programming 101,1,01-SEP-2011 20,Databases 101,1,03-SEP-2011 10,Programming 101,2,20-SEP-2011 20,Databases 101,2,27-SEP-2011
I need to get it into the following hash of hashes structure :
my %courses= ( '10' => { 'desc' => 'Programming 101', 'sittings' => { '1' => '01-SEP-2011', '2' => '20-SEP-2011', }, }, '20' => { 'desc' => 'Databases 101', 'sittings' => { '1' => '03-SEP-2011', '2' => '27-SEP-2011', }, }, );
But I'm completely stumped . . wish I could show what code I got . . . but I got nothing . . . . Many Thanks.
In reply to Hash of Hashes by swandown
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |