http://www.perlmonks.org?node_id=482696

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a set of outline style numbers ( 1.0, 1.0.1, 1.0.2, 1.1, 2.0, 2.0.1, ... ) and I want to sort them. The decimal points separate tiers, not digits. Unfortunately, Perl wants to sort them wrong - placing 1.10.1 between 1.1 and 1.2, for example. And sorting with <=> doesn't work either because of the extra decimal points. Can anyone please suggest a way to sort these correctly? Also, I don't know how many tiers deep it will be, so I could have a number like 1.10.1.1.3 or something.