in reply to executing commands and getting output from program

Try to look at module Net::SSH::Perl:

my $ssh = new Net::SSH::Perl('host_name'); $ssh->login('user_name', 'user_pass'); my ($stdout, $stderr, $exit_code) = $ssh->cmd('ls -l');

_ _ _ _ _ _
  M i c h a e l