Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Complex Data Structure Suggestions Wanted

by djohnston (Monk)
on Jun 07, 2005 at 17:43 UTC ( [id://464403]=note: print w/replies, xml ) Need Help??


in reply to Complex Data Structure Suggestions Wanted

Here are a couple more alternatives...
sub ReadSource{ my ($DataSource, $HashRef) = @_; my @Data = get_data(); for (@Data){ my $item = $HashRef->{$_} ||= []; push( @$item, $DataSource ); } }
..or..
sub ReadSource{ my ($DataSource, $HashRef) = @_; my @Data = get_data(); push( @{ $HashRef->{$_} ||= [] }, $DataSource ) for @Data; }
There really is more than one way to do it!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://464403]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-03-28 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found