Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: hashes - treating all keys/ values as one

by OM_Zen (Scribe)
on Feb 27, 2003 at 15:48 UTC ( #239126=note: print w/ replies, xml ) Need Help??


in reply to hashes - treating all keys/ values as one

Hi ,

The @pair and @value contain scalars and not list of values .

May be if the $pair ,the $value you have are references then you should dereference it to get the arrays first and then start the hash creation and accessing the elements

use strict; my @pair; my @values; my $pairs; my $value; # if the $pair and $value you mentioned # are references then dereference it with # the statements here : @pair = @$pairs; @values = @$value ; my @hashofarrays{@pair} = @values; foreach (my ($Key , $Value) = each %hashofarrays){ print "$Key , $Value\n"; }


Comment on Re: hashes - treating all keys/ values as one
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2015-07-28 22:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls