in reply to Re^3: Tring to write script to add and get employee detials to hash
in thread Tring to write script to add and get employee detials to hash

"[YAML] maps to Perl data structures better than JSON ..."

I was not aware of that. I do recall having some issues with de-serializing anonymous subs into Perl data from JSON text, but i would like for you to give more details as to why you have this opinion, please. In the meantime, i found this link which has more interesting perspectives on which to use: http://stackoverflow.com/questions/1876735/should-i-use-yaml-or-json-to-store-my-perl-data

I myself have opted to use JSON for feeding information to programs (robots) and YAML for feeding information to humans. :) I also try to keep my data simple, which means not having to worry about anonymous sub references. I strive to keep my data in my data and my code in my code.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^5: Tring to write script to add and get employee detials to hash
by Anonymous Monk on Mar 27, 2015 at 17:31 UTC
    i would like for you to give more details as to why you have this opinion, please

    The opinion was perhaps stated a little more strongly than it should have been. When I was choosing a serialization format a year or two ago, I recall having an easier time getting YAML to round-trip certain data structures (I think it was undefs, numeric values and/or booleans) more cleanly than JSON. If I have a little more time later I might try to reproduce those issues.

Re^5: Tring to write script to add and get employee detials to hash
by Anonymous Monk on Mar 29, 2015 at 19:44 UTC

    So a quick test showed that both YAML::XS and JSON::XS round-trip some simple data structures equally well. So now I'm not sure anymore if back then I was testing different modules which did have issues round-tripping some data structures, or whether I'm just remembering wrong.

    One thing I did remember is that I like YAML's facilities for including string literals, kind of like here docs:

    --- foo: | Hello World: cool I'm a three-line string literal

    AFAIK there's no here docs in JavaScript / JSON...