Thank you.
It also works for me but I was not using sftp->disconnect(), only the sftp->new. At the end of the script I used undef $sftp, it worked for linux OS but not for Soloris. It was annoying me a lot for long time.
Comment on Re: Net::SFTP::Foreign message on disconnect
I ramdomly get "Killed by signal 15." on STDERR as well. I've added these two lines to see if this will resolve my issues. My next step will be to localize the signal.
$sftp->disconnect; #try to avoid random error "Killed by signal 15."
undef $sftp;