Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^12: Storing/parsing perl data structure in/from a file

by Wilderness (Novice)
on Jun 13, 2013 at 23:47 UTC ( #1038866=note: print w/ replies, xml ) Need Help??


in reply to Re^11: Storing/parsing perl data structure in/from a file
in thread Storing/parsing perl data structure in/from a file

Sorry to have completed pissed you off. It's ironical that I know it is an XY problem, yet I do not know what X and Y are...Anyways, after looking at all the responses, I wanted to know more about tying hashes and being able to override methods like STORE, FETCH, etc. to make them work for my multi-dimensional hash. But I haven't used OO-Perl before so I am struggling to write my own recursive methods to make it work for multi-level structures. I will go with YAML. It looks a lot more elegant than perl hashes in a file.


Comment on Re^12: Storing/parsing perl data structure in/from a file
Re^13: Storing/parsing perl data structure in/from a file
by LanX (Canon) on Jun 14, 2013 at 00:39 UTC
    You didn't piss me off, it's just not easy to speculate about fictional use cases!

    The tied hash doesn't work with nested literal hashes, they are cleaned at compile phase.

    Though you can use nested literal arrays like demonstrated w/o information loss.

    Assign them to a tied array, which STOREs them internally in a tied hash.

    Or just a normal array which is parsed afterwards!

    And yes YAML looks better! =)

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-07-11 23:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (236 votes), past polls