Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Calling a hash through an array value

by dragonchild (Archbishop)
on Jan 08, 2003 at 21:17 UTC ( [id://225358]=note: print w/replies, xml ) Need Help??


in reply to Calling a hash through an array value

Bad c! No cookie! We do not use symbolic references.

Instead, make a hash of hashes (or HoH). So, do something like:

my %asn; for my $i (@asnValues) { my @asnParams = split / /, $i; my $keyName = $asnParams[0]; $asn{$keyName}{risk} = $queueNsp[2]; }
Treat it as you would a 2-D array in C or BASIC or JAVA or any other language. The only difference is that you don't have to pre-declare it. Perl does that for you on the fly. (If you don't need or want to know how, then just assume it will work and go about your business.)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Replies are listed 'Best First'.
Re: Re: Calling a hash through an array value
by FamousLongAgo (Friar) on Jan 08, 2003 at 22:25 UTC
    Well, of course we can use symbolic references - when it's the right thing to do.

    But here it's not.

    Here is a detailed explanation (Dominus article) for why dragonchild bit your head off.

Log In?
Username:
Password:

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

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

    No recent polls found