Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: YAML::XS, YAML::Syck and boolean values

by Loops (Curate)
on Jul 26, 2013 at 06:05 UTC ( [id://1046455]=note: print w/replies, xml ) Need Help??


in reply to YAML::XS, YAML::Syck and boolean values

This is surely just an internal optimization to save memory. It's not significant in this test data, but it could be for large duplicate structures. It should be transparent in any case that matters, no? The structure is readonly, so there is no danger in updates at least.
my $val = $data->[1]->{active}; print Dumper $val;
Prints:
$VAR1 = 1;
Which I admit is hardly worth the space it took to quote... Worst case there is this:
my $clean = [ map {{%$_}} @$data ]; print Dumper \$clean;
Outputs:
$VAR1 = \[ { 'name' => 'Bob Johnson', 'active' => 1, 'happy' => '' }, { 'name' => 'Bill Johnson', 'active' => 1, 'happy' => 1 }, { 'name' => 'Frank Johnson', 'active' => '', 'happy' => '' }, { 'name' => 'George Johnson', 'active' => '', 'happy' => 1 } ];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-20 04:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found