use warnings; use strict; use IPC::Run3 'run3'; my $in = " string argument passed "; my @cmd = ('/path/to/shellscript.sh'); run3 \@cmd, \$in, \my @out or die "run3 failed"; $?==0 or die "command failed, \$?=$?"; chomp(@out); print "<<$_>>\n" for @out;