Initiating subroutine to copy war on remote machine... Copying war: remote-web.war Target Machine: xx.xxx.xxx.xx User: tom Use of uninitialized value $HOME in string at /home/tom/deploy.pl line 59. War copied on deployment machine. Now moving on to next task of archiving the war... at /home/tom/perl/5.18.2/lib/site_perl/5.18.2/Expect.pm line 760. I tried reading Expect.pm file around the error # but couldn't understand. Does it has anything to do with the earlier object not getting freed up? I couldn't find any method on the CPAN page for this module to close the connection.