Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Complex Data Structure Suggestions Wanted

by Roy Johnson (Monsignor)
on Jun 07, 2005 at 11:15 UTC ( #464235=note: print w/replies, xml ) Need Help??


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:
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

    Thank you, I prefer the preferred notation nice to agree with the masses for a change.

    "No matter where you go, there you are." BB

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2020-11-28 23:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?