my $ct = $pgp->encrypt( Filename => 'plain.txt', Recipients => $key, Cipher => 'DES3', SignKeyID => $signkey, SignPassphrase => $GPG_PP ) or die "Encryption failed: ", $pgp->errstr; if ($ct) { open( my $fh, '>', 'encrypted.gpg' ); print $fh $ct; close $fh; } else { #print "gpg failed: $pgp->errstr\n"; $err = Crypt::OpenPGP->errstr; print "gpg failed: $err\n"; }