Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Converting hash structure into a special tree

by kschwab (Vicar)
on Jan 13, 2019 at 14:20 UTC ( #1228468=note: print w/replies, xml ) Need Help??


in reply to Converting hash structure into a special tree

How about Data::TreeDumper?
use Data::TreeDumper; $Data::TreeDumper::Maxdepth=4; $Data::TreeDumper::Useascii=1; $Data::TreeDumper::Displayaddress=0; my $d= { "one" => 1, "two" => 2, "array" => [1,2,3,4], "hash" => {"test" => "me"} }; print DumpTree($d,'Contents of $d');
Outputs:
Contents of $d
|- array 
|  |- 0 = 1 
|  |- 1 = 2 
|  |- 2 = 3 
|  `- 3 = 4 
|- hash 
|  `- test = me 
|- one = 1 
`- two = 2 

Replies are listed 'Best First'.
Re^2: Converting hash structure into a special tree
by ovedpo15 (Pilgrim) on Jan 13, 2019 at 14:33 UTC
    It looks like an amazing module! Sadly I can't use it because it is not installed (And I can't install new modules on my school project). I'm allowed to use about 500 modules but Data::TreeDumper is not one of them. :(
    EDIT: I saw that I have 'Tree::DAG_Node' module. I tried to read the docs but it does not do the format I need.
        I tried to use that module and the docs are quite good. But it feels like it is not so efficient because I will be using that module and then convert the output to the wanted output. I think that it will be more efficient to create a loop which will reproduce this output, but I'm not so sure. Do you have any other suggestions maybe?
Re^2: Converting hash structure into a special tree
by ovedpo15 (Pilgrim) on Jan 14, 2019 at 02:02 UTC
    I would try to convince my lecture to let me use that module. What structure do you recommend me to pass to the module? Can you give me a hint on how to implement it? I read the docs it feels straight forward but I'm not sure which hash format should I pass and which algorithm to implt in order to create one.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2022-01-21 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (57 votes). Check out past polls.

    Notices?