Hi guys,

I've been working on a sort function to sort a number
of version numbers, and...out of curiousity:
Is there a faster way to do it than this ?:
#!/usr/bin/perl -w use strict; sub ByVersion; my @VersionList=("1.1","1.1.1","2.0","1.2_patch3","33.0","1.1.1.1","1. +a.1","1.b.1","1.b.1.a","1.b.1.b","1.33.0","1.0.a","1.0.b","33.1","6.6 +.6","10.0","9.0","3.1.4","3.1.12"); chomp (@VersionList); my @Sorted=sort ByVersion @VersionList; print "Sorted to: @Sorted\n"; sub ByVersion { my @First=split /\./,$a; my @Second=split /\./,$b; my $Nr=($#First>$#Second)?$#Second:$#First; foreach(0..$Nr) { next if ($First[$_] eq $Second[$_]); return ("$First[$_]$Second[$_]"=~/^\d$/o)?($First[$_] <=> $Second[$_ +]):($First[$_] cmp $Second[$_]); } return ($#First>$#Second)?1:-1; }
Now the output is really what I would like it to be....
BUT... is there a quicker or more elegant way to do it ? ;))

I had my fun with it so far ;))), just wondering if there
are better ideas out there ;))

GrtZ!,