In the rename statement, you're renaming a file with filename of <encrypted data>, which is probably not what you want.
I also don't understand what the rename is supposed to do. You can just open de output file with the right (.pgp) extension, print the encrypted data to it and be done with it.
Arjen
Comment on Re: How do I get the output of Crypt::OpenPGP to a file