in reply to Version Sorting
Basically, it converts each number part to a byte value, so the resulting version string is fixed-width (for the number of fields it has) and can be efficiently sorted. Then it sorts and converts back.use strict; use warnings; chomp(my @version = <DATA>); print join "\n", @version = map { join '.', unpack 'C*', $_ } sort map { pack 'C*', split /\./, $_ } @version; __DATA__ 1.2.3 1.3.4 1.2.31 1.12 1.12.1 1.12.12
|
|---|