in reply to Re: Rule-based sorting
in thread Rule-based sorting

Borrowing from I0, I offer this alternative:

return map { if( s/^2// ) { $_; } elsif( /^([01])(\d\d\d)(.*)\Q$;\E(.*)$/ ) { $3 . substr(300-$2,-2) . $4 . "_" . ($str1,$str2)[$1] } } sort map { if( ! /(.*)(\d\d)(.*)_(?:\Q$string1\E|(\Q$string2\E))$/ ){ 2.$_; }else{ (0+defined($4)) . (200-$2) . $1 . $; . $3; } } @strs;

which may be the fastest yet once you get enough elements to sort (and you have to set $; to something that won't be in your strings).

        - tye (but my friends call me "Tye")