Fix Pair.perl to properly handle the case where the key is a Pair.  Fixes #167.