in reply to Complex Data Structure Suggestions Wanted
Here are a couple more alternatives...
..or..sub ReadSource{ my ($DataSource, $HashRef) = @_; my @Data = get_data(); for (@Data){ my $item = $HashRef->{$_} ||= []; push( @$item, $DataSource ); } }
There really is more than one way to do it!sub ReadSource{ my ($DataSource, $HashRef) = @_; my @Data = get_data(); push( @{ $HashRef->{$_} ||= [] }, $DataSource ) for @Data; }
|
---|
In Section
Seekers of Perl Wisdom