in reply to Hash of Hashes

use warnings; use strict; use Data::Dumper; $Data::Dumper::Sortkeys = 1; my %courses; while (<DATA>) { chomp; my ($id, $desc, $sit, $date) = split /,/; $courses{$id}{desc} = $desc; $courses{$id}{sittings}{$sit} = $date; } print Dumper(\%courses); __DATA__ 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
prints...
$VAR1 = { '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' } } };

Replies are listed 'Best First'.
Re^2: Hash of Hashes
by swandown (Novice) on Aug 30, 2011 at 13:34 UTC

    Superb! Thank you so much toolic and Corion.