http://www.perlmonks.org?node_id=464237


in reply to Complex Data Structure Suggestions Wanted

I haven't tested this either, but what about this:
sub ReadSource{ my $DataSource = shift; my $HashRef = shift; foreach my $ItemID (@Data) { defined $HashRef->{$ItemID} ? push @{$HashRef->{$ItemID}}, $DataSource : $HashRef->{$ItemID} = [$DataSource]; } }

cLive ;-)

edit - nevermind, I forgot about autovivifying. It's late dammit...