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

I mean, when I do `do $file`, Perl would read the entire data structure at once and overwrite hash keys with the last value it reads. I wish there was a way for me to traverse through the data structure (which Perl would be doing internally to be able to find key collisions) manually.
  • Comment on Re^4: Storing/parsing perl data structure in/from a file

Replies are listed 'Best First'.
Re^5: Storing/parsing perl data structure in/from a file
by LanX (Saint) on Jun 13, 2013 at 00:06 UTC
    It's correct that do file means slurp + eval but your data only defines an anonymous hash on the top level.
    { alpha => { beta => { gamma => theta, delta => lambda, }, beta => { gamma => zeta, }, }, },

    you need to add a variable name!

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      How can I manually slurp + eval if I have a named hash?