Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: trying to print hashes with mixed results

by merrittr (Novice)
on Apr 09, 2021 at 02:36 UTC ( [id://11131037]=note: print w/replies, xml ) Need Help??


in reply to Re: trying to print hashes with mixed results
in thread trying to print hashes with mixed results

Sure that will work , but just from a learning standpoint how could I get that loop work and print the values?
  • Comment on Re^2: trying to print hashes with mixed results

Replies are listed 'Best First'.
Re^3: trying to print hashes with mixed results
by Fletch (Bishop) on Apr 09, 2021 at 02:39 UTC

    From your output you are; it's just the values are themselves hashrefs. You'd need to then iterate over those in turn. The simplest solution is going to be to use Data::Dumper (or YAML::XS or JSON::PP or . . .).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re^3: trying to print hashes with mixed results
by LanX (Saint) on Apr 09, 2021 at 03:05 UTC
    > but just from a learning standpoint how could I get that loop work and print the values?

    you are looping over a hash-ref and $v is another hash-ref, again.

    so start another loop over $v.

    In the general case you'll need a recursive function which loops over hash-refs and array-refs.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re^3: trying to print hashes with mixed results
by haukex (Archbishop) on Apr 09, 2021 at 06:41 UTC
    Sure that will work , but just from a learning standpoint how could I get that loop work and print the values?

    See Hashes of Hashes in perldsc.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-24 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found