I have two scripts, namely shell_script.sh
and perl_script.pl
.
shell_script.sh
: It has function definitions which, when invo
It's overkill for this problem, but Env::Modify provides a way to make shell functions available in Perl. With Env::Modify
, you could, say, import the shell functions once and use them over and over again in subsequence system
calls.
use Env::Modify qw(:bash system source qx);
# import the shell functions
system("source shell_script.sh ; export -f func_1 func_2");
# alternate: put "export -f func_1 func_2" at the end of shell_script.sh and call
source("shell_script.sh");
# use the shell functions
system("func_1");
$output = `func_2`;
...