Closed mrenvoize closed 5 years ago
Ok, there are several things:
Hash keys in perl are all strings, so "16.05" lt "3.00"
is actually correct.
Also I cannot reproduce the behavior here, YAML/YAML::XS/YAML::PP all produce the same order:
perl -wE'
use YAML ();
use YAML::XS ();
use YAML::PP;
say YAML->VERSION;
say YAML::XS->VERSION;
say YAML::PP->VERSION;
my %hash = ( "3.00" => 1, "16.05" => 2 );
say YAML::Dump \%hash;
say YAML::XS::Dump \%hash;
say YAML::PP::Dump \%hash;'
1.28
0.77
0.013
---
16.05: 2
3.00: 1
---
'16.05': 2
'3.00': 1
---
'16.05': 2
'3.00': 1
Can you provide an example?
Ack, I'm sorry for wasting your time... issue was between the screen and the keyboard :(.
Seems I was comparing the human written YAML to the YAML output after parsing and dumping again.. not comparing two dumped outputs.
Feeling rather stupid now.. not my most intelligent moment. You're doing a fantastic job of cleaning up the YAML implementations for perl, thankyou for the efforts.
oh, no worries, that happens to all of us =)
I've not yet managed to get my community on board with switching from YAML to YAML::XS unfortunately.
Whilst converting some code I'd written back from YAML::XS to YAML I noticed that the keysorting in YAML is different (and in my opinion incorrect).
YAML::XS will sort 3.00 before 16.05 but YAML outputs 16.05 before 3.00 as an example.