You don't have to check for existence. You can just use an undefined value as an arrayref and it will autovivify:
foreach my $ItemID (@Data){ push @{$$HashRef{$ItemID}}, $DataSource; # The usual preferred notation is # push @{$HashRef->{$ItemID}}, $DataSource; }

Caution: Contents may have been coded under pressure.

In reply to Re: Complex Data Structure Suggestions Wanted by Roy Johnson
in thread Complex Data Structure Suggestions Wanted by Ninthwave

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":