insensate has asked for the wisdom of the Perl Monks concerning the following question:
I need to sort the above array by version. A simple ascii sort will incorrectly put version 1.0.9 after 1.0.10 etc. My best guess is that i need to sort using a usersub that will split the versions on /./ into $maj,$min,$rev and use the <=> operator to sort on each in turn. If anybody knows of any modules that will make this easier...or simply a good starting point I would be much oblidged. Thanks in advance, Jason@versions=qw(2.0.0 1.0.9 1.0.10 1.1.0 1.1.2);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sorting An Array of Versions
by dragonchild (Archbishop) on Mar 12, 2002 at 17:56 UTC | |
|
(tye)Re: Sorting An Array of Versions
by tye (Sage) on Mar 12, 2002 at 19:10 UTC | |
|
Re: Sorting An Array of Versions
by perrin (Chancellor) on Mar 12, 2002 at 18:49 UTC | |
|
Re: Sorting An Array of Versions
by dreadpiratepeter (Priest) on Mar 12, 2002 at 18:05 UTC | |
|
Re: Sorting An Array of Versions
by I0 (Priest) on Mar 12, 2002 at 18:45 UTC | |
|
Re: Sorting An Array of Versions
by blakem (Monsignor) on Mar 12, 2002 at 19:00 UTC | |
|
Re: Sorting An Array of Versions
by Dog and Pony (Priest) on Mar 12, 2002 at 19:07 UTC | |
by tye (Sage) on Mar 12, 2002 at 19:19 UTC | |
by Dog and Pony (Priest) on Mar 12, 2002 at 19:23 UTC |