http://www.perlmonks.org?node_id=1054241


in reply to perl expect

useNet::OpenSSH;
... my ($host, $user, $password, @cmds) = split ',', $line; my $ssh = Net::OpenSSH->new($host, user => $user, password => $passwor +d); if ($ssh->error) { print STDERR "Unable to log into remote host: ".$ssh->error; next; } print "HOST: $host\n\n" for my $cmd (@cmds) { my ($out, $err) = $ssh->capture2($cmd); print "CMD: $cmd\nRC: $?\nSTDOUT:\n$out\nSTDERR:\n$err\n\n\n"; }
Consider also using some CPAN module to parse the CSV files (i.e. Text::CSV). That way you will be able to handle files with quoted fields inside correctly.