Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: naming array from a scalar

by colwellj (Monk)
on Nov 10, 2009 at 00:02 UTC ( [id://806077]=note: print w/replies, xml ) Need Help??


in reply to naming array from a scalar

George,
You can create a hash of arrays.
That way your array is 'named' by hash
However your foreach loop dosen't make much sense to me in this context. I think you need to declare $val perhaps?
my %hash; foreach my $val(@array){ push @{$hash{$val}}, database_call($val) }
To then print a particular named array
foreach(@{$hash{$val}}){ print $_ } #to find a particular item in a particular array print $hash{$val}[$arrayid]

Replies are listed 'Best First'.
Re^2: naming array from a scalar
by Anonymous Monk on Nov 10, 2009 at 01:29 UTC
    Thanks much..That works for me.
    -George

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found