$sql = qq{select course_id,course_name,course_sitting_id,course_sitting_date from courses};
$sth = $dbh->prepare($sql) or die . . .;
$sth->execute() or die . . . .;
while (@fetch = $sth->fetchrow)
{ . . . .
####
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
####
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',
},
},
);