In my case manual sftp was working. But the script was dropping the connection after successfully authenticating and after sending the SSH2_FXP_INIT packet.
Solution:-
Perl sftp client uses interactive mode for running command. Refer :- http://search.cpan.org/~drolsky/Net-SFTP-0.08/eg/psftp
As the login id for sftp I used was not configured for interactive ssh connection, whenever I used to loging to server using "ssh -v server name", after authenticating it was dropping the connection.
As sftp id is not supposed to have right to execute command at remote end, The login id was disabled for interactive mode.
I asked sftp server SA to enable the interactive ssh session, the problem got resolved.
(2)
]
