Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Do values from string exist within array?

by talexb (Canon)
on Sep 30, 2013 at 16:37 UTC ( #1056386=note: print w/ replies, xml ) Need Help??


in reply to Do values from string exist within array?

Do you actually have a structure that looks like this?

my %hash = ( 'GrpID' => [ 123, 456 ] );

That would be a hash with a single key, whose value is an arrayref. You could find out how many values were present by looking at the value of scalar @{$hash{'GrpID'}} -- in this example, the value should be 2, meaning there are multiple values.

And you'd put values into that hash entry with

push ( @{$hash{'GrpID'}}, 789 );
I'd recommend you pop into the Perl debugger and try this stuff out. The debugger's a great place to try out Perl constructs.

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.


Comment on Re: Do values from string exist within array?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2014-11-22 10:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (121 votes), past polls