in reply to Question on system function

Are you running your script from the command line or from a cron job or something like that? If you don't have a tty, abc can know that and behave differently. You can fool it into thinking you have a tty when you don't, but I'm not sure off the top of my head how you do that. Expect probably has that capability.

Soooo, I recommend you check out Expect.

It looks like you're automating gpg. There might be gpg helper modules on CPAN as well.

--Pileofrogs