in reply to Using Asymmetric keys for Encryption

from the Crypt::OpenPGP manual...
$pgp->encrypt (%args) %args can contain: * Data - The plaintext to be encrypted. This should be a simple scala +r containing an arbitrary amount of data. Data is optional; if unspecified, you should specify a filename (see F +ilename, below).
So you should just be able to call
$pgp->encrypt(Data=>$credit_card_number,Recipients=>$key_id,Armour => +1,);
Cheers,
Ben