in reply to SFTP perl script

Try using Net::SFTP::Foreign instead.

It is known to work reliably in any perl from 5.6.1 upwards and also in Solaris (and if you find any bug, I will try hard to correct it! :-).

Note that you will have to install Expect if you want to use password authentication.