use Net::OpenSSH; my $ssh = Net::OpenSSH->new($host, user => $user, password => $pass); unless ($ssh->scp_get({ stdout_file => './scp-capture', stderr_to_stdout => 1 }, $src_path, $dst_path)) { say "SCP failed: " . $ssh->error; ... }