Actually pick .lib file when multiple perl libs are present

7240962f8626ff09bb8f9e71ecdb074775bdd035 got it right in the comment,
but the code did not actually do what the comment said. Fix that.

Issue pointed out by Noah Misch.
