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

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056386]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2017-10-23 00:02 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (275 votes). Check out past polls.