in reply to Re: sorting an array with decimal points (updated)
in thread sorting an array with decimal points
Better yet, just use the Sort::Naturally module from CPAN
Sort::Naturally does not handle numbers with decimals correctly. For instance, nsort '1.10', '1.31', '1.4' returns 1.4 1.10 1.31.
But you can use Sort::Key::Natural instead which provides a set of functions for sorting strings embedding numbers with decimals:
use Sort::Key::Natural qw(natwfsort); my @sorted = natwfsort @array;
Update: Though, taking into account that the data in the OP says Patch_, maybe those numbers are actually version numbers and then the part after the decimal dot may be better sorted as an independent integer, which is what a regular natural sort does...