in reply to more fun with references and hashes

Couple things I see here..

First, if you have a refrence to a hash, doing $pin_hasref{$pin} isn't going to work. What that says is that You have a hash named %pin_hasref, and you don't. You have a scalar named $pin_hashref that is a refrence to a hash. So you need to do the following..

$new_hash{$pin} = $pin_hashref->{$pin};
Second, I think what you want to return is a refrence to your new hash, not just the contents.

Hope this helps..
Rich