#!/usr/bin/perl -w use strict; use CGI; use GnuPG; my $gnupg = new GnuPG(homedir => '/path/to/home/dir', gnupg_path => '/rath/to/gpg'); # yadda yadda # and then encrypt someting like this (grabbed from docs, amend to suit...) $gpg->encrypt( plaintext => "file.txt", output => "file.gpg", armor => 1, sign => 1, passphrase => $secret);