Written to a YAML file using YAML::XS DumpFile I get something like this:$VAR1 = { 'path' => '/export/home/frank' 'options' => [ { 'value' => '1001', 'param' => 'i' }, { 'param' => 'f' }, { 'value' => 'eyes', 'param' => 'x' }, {}, { 'value' => 'toes', 'param' => 'b' }, { 'param' => 'p' }, ], 'arguments' => [ { 'value' => 'test' } ], };
Rather, I'd like for it to be something like this:arguments: - value: test path: /export/home/frank options: - param: i value: '1001' - param f - param: x value: eyes - flag: b value: toes - param: p
The problem is, I'm not sure what the data structure would look like to create this in YAML. Anyone have any ideas how to do this? I want things to be ordered. First the path, then the options (in order), then the arguments (also in order). But, with the way hashes work, and with YAML's use of dashes for ordering, I cannot seem to accomplish this with DumpFile.path: /export/home/frank options: - param: i value: '1001' - param f - param: x value: eyes - flag: b value: toes - param: p arguments: - value: test
In reply to Keeping Order with YAML::XS by walkingthecow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |