%hash; while (<>) { my ($dept,$email)=split(/:/); $hash{$dept}{'email'} = $email; }