Hello, there are perl modules for this kind of job, e.g. Net::SFTP::Foreign, Net::SSH2.
Maybe these modules help you to integrate ssh better into your perl scripts.
... and Net::OpenSSH that being on an Unix OS, maybe Linux, it's probably the easiest one to install and use for SCP file copy.
use Net::OpenSSH;
my $ssh = Net::OpenSSH->new('root@foo.bar.com',
passwd => $passwd,
port => 223);
$ssh->scp_put("/home/my/local/file/whatever.txt",
"/my/remote/path_name");