YAML::PP::Preserve

You can also create preserved nodes from scratch:
use YAML::PP; use YAML::PP::Common qw/ :PRESERVE :STYLES /; my $yp = YAML::PP->new( preserve => PRESERVE_ORDER PRESERVE_SCALAR_STYLE PRESERVE_FLOW_STYLE ); my $hash = $yp->preserved_mapping({}, style => YAML_FLOW_MAPPING_STYLE); %$hash = (z => 1, a => 2, y => 3, b => 4); $hash->{doublequotes} = $yp->preserved_scalar( "lala", style => YAML_DOUBLE_QUOTED_SCALAR_STYLE ); say $yp->dump_string($hash); __END__ --- {z: 1, a: 2, y: 3, b: 4, doublequotes: "lala"}
Slide 30/46 BACK UP NEXT next: ( space / -> / page up ) | previous: ( backspace / <- / page down ) | next page: ( shift + page down ) | previous page: ( shift + page up ) | index: ( arrow-up )