Hello Just out of curiosity why do you need such a function? I'm no perl programmer and have very little knowledge of the language ... yet ; ) but the way you describe it it seems to me that you have a fundamentle design flaw in your script if you need to change types on the fly that are in no way related to each other. (Even in a typeless language such as PHP)
My suggestion: For the cases you need the blessing create a proxy object or an adapter object to give you access to the needed stuff. Regards Stefan Langer