in reply to Re: Pass local bash script to remote host via SSH
in thread Pass local bash script to remote host via SSH

Even shorter...
use Net::OpenSSH; die "Couldn't establish SSH connection: ".$ssh->error if $ssh->error; $ssh->system({stdin_data => <<EOD}, 'bash', '-s') or die "command fail +ed: " . $ssh->error; # ... EOD