in reply to Script running through cron throwing error else works fine

mkdir //.ssh: Permission denied at /usr/lib/perl5/vendor_perl/5.8.5/Net/SSH/Perl/Util/Hosts.pm line 92
(1) Did you have a look at line 92?

(2) If we believe the error message, it tries to create a directory //.ssh. The two slashes are strange in this context. Could it be, that the directory to be created, should be something like $ENV{HOME}/.ssh, and HOME happens to be set to '/'?

-- 
Ronald Fischer <ynnor@mm.st>