in reply to Complex Data Structure Suggestions Wanted
You don't have to check for existence. You can just use an undefined value as an arrayref and it will autovivify:
Caution: Contents may have been coded under pressure.
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Complex Data Structure Suggestions Wanted
by Ninthwave (Chaplain) on Jun 07, 2005 at 12:19 UTC |
In Section
Seekers of Perl Wisdom