Since you know what you're aiming at, just use the yaml as a template. Load it into Perl and then dump the resulting data structure:
Produces:use YAML::XS qw(LoadFile); use Data::Dump qw(pp); pp LoadFile(\*DATA); __DATA__ path: /export/home/frank options: - param: i value: '1001' - param f - param: x value: eyes - flag: b value: toes - param: p arguments: - value: test
{ arguments => [{ value => "test" }], options => [ { param => "i", value => 1001 }, "param f", { param => "x", value => "eyes" }, { flag => "b", value => "toes" }, { param => "p" }, ], path => "/export/home/frank", }
Which after looking back at your original post, is essentially the same as your input (which has a missing comma). So its not a matter of finding a data structure that produces your desired YAML. Maybe it's better to have asked why you want a specific format to your YAML? Isn't any format that properly encodes your data, okay?
In reply to Re: Keeping Order with YAML::XS
by Loops
in thread Keeping Order with YAML::XS
by walkingthecow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |