in reply to Re^4: NET::SFTP::Foreign in perl
in thread NET::SFTP::Foreign in perl

No, the SFTP protocol does not allow arbitrary execution of commands on the remote side.

My other module Net::OpenSSH, that integrates nicely with Net::SFTP::Foreign would allow you to do so. It needs a recent OpenSSH client and only works on Linux/Unix.

Another options are Net::SSH2 (not completely stable yet) and Net::SSH::Perl.

update: BTW, you can not run arbitrary commands on the remote side but you can create directories if that is all you want:

$sftp->mkdir('/foo/bar');