in reply to using ssh within perl script

Because you're doing it wrong in the perl script? We'll try to give you a more detailed answer when you give us a more detailed question. Could you provide us with the Perl script, for starters?

Alternatively, it could be a permission issue. Are you running the perl script from the shell, or from your web server (CGI)? If it's the latter, the script may be running as another user, which means it won't be able to access your authentication key.