in reply to Incorrect options supplied, exiting.

Your code as posted does not reproduce the problem, because you never call run_command.

My guess is that the command as constructed is wrong for some reason, and that makes the called program exit. I would print out the commands before they are run, and then check that the commands actually can run on their own, before blaming IO::Pipe.

sub run_command { my $user = 'gmon'; my $system = shift; my $protocol = 'ssh'; my $ssh_flags = "-l $user"; my $command = "statvv -ni"; my $space = " "; my $do_command = $protocol . $space . $ssh_flags . $space . $syste +m . $space . $command; print "Running [$do_command]\n"; my $cmd = IO::Pipe->new; $cmd->reader($do_command); return $cmd; }

Also, why are you using IO::Pipe at all if you just want to run one command? You can use Perl to open a pipe-filehandle:

sub run_command { my $user = 'gmon'; my $system = shift; my $protocol = 'ssh'; my $ssh_flags = "-l $user"; my $command = "statvv -ni"; my $do_command = "$protocol $ssh_flags $system $command"; print "Running [$do_command]\n"; open my $fh, "$do_command |"; return $fh; }

... or you could just read the contents of the command directly:

sub run_command { my $user = 'gmon'; my $system = shift; my $protocol = 'ssh'; my $ssh_flags = "-l $user"; my $command = "statvv -ni"; my $do_command = "$protocol $ssh_flags $system $command"; print "Running [$do_command]\n"; my @results = `$do_command`; return @results }