Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Traversing a complex data structure searching for certain keys and printing their values

by LanX (Canon)
on Apr 28, 2013 at 23:38 UTC ( #1031122=note: print w/ replies, xml ) Need Help??


in reply to Traversing a complex data structure searching for certain keys and printing their values

Hi

> I am calling this subroutine like this but I can't get it to accept passing @keylist to it.

changing

recurse_hash(\%$decoded_json_obj,"@keylist");

to

recurse_hash(\%$decoded_json_obj,@keylist);

should do.

And please, Perl has variable interpolation, so never put variables into doublequotes if you don't them to be expanded.Use single quotes!

HTH =)

Cheers Rolf

( addicted to the Perl Programming Language)

UPDATE

> If I hardcode the key names like so it doesn't error and prints all all the corresponding values but they are all on different lines and don't match up.

I don't understand, could you show us the problem with your input?


Comment on Re: Traversing a complex data structure searching for certain keys and printing their values
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2014-10-01 00:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (386 votes), past polls