in reply to Best Way to Map Data

If you don't mind the extra step of removing the trailing comma then a hash should work:

my %hash; while ( <> ) { my ( $dept, $email ) = split /:/; $hash{ $dept } .= "$email,"; } s/,\z// for values %hash;