#!/usr/bin/perl -w use strict; use Carp; use GPG; my( $gpg ) = new GPG( homedir => "/home/alice/.gnupg" ); croak $gpg->error() if $gpg->error(); my( $enc ) = $gpg->encrypt( "Can you read this", "bob\@dot.com" ); croak $gpg->error() if $gpg->error(); print $enc;