+1 to this. Besides, the patterns don't use anchors and they aren't in reverse length order. Correct me if I'm wrong, but this means 3.6 will match before 3.6.1?

IMHO, this function should always return the version number, even if it's not expected/known/supported. That means returning "2.1" if the version is 2.1. It's the job of the caller to determine if it can't handle this version. So I think that the pattern shouldn't hard-code to 3.X like the above suggests. It might even be better to return in the form of one or more integers so that sensible version range checks can be performed.

Just my $0.02 :)