in reply to Sorting An Array of Versions
I like:
(I assumed no "\0" characters in the version strings as it makes the code extra simple.) Note that this doesn't assume how many fields each version string has nor that you don't have version numbers like "1.0a".my @sorted= map { s/\0(....)/unpack("N",$1)/gs } sort map { s/(\d)/"\0".pack("N",$1)/g } @versions;
See also Sorting on Section Numbers (which includes why Sort::Versions might not be the best choice) and How do I do a natural sort on an array?.
- tye (but my friends call me "Tye")
|
|---|