B.W. said:
I want to call another script B in script A and get the result if the
execution of script B is successful, can someone show me how to do that? ....
B.W.
I assume you mean Perl scripts. Check out the following docs:
perldoc -f system
perldoc perlop
paying special attention to the bit about the qx operator (or
'backticks') in the "Regexp Quote-like Operators" section.
perldoc -q "output of a command"
(or perldoc -q 'output of a command', depending on your OS)
Or do you perhaps mean you want to execute additional Perl code (which
you call "script B" from some other Perl code you call "script A",
without running another instance of the Perl interpreter in another
process? If that is the case, check out:
perldoc -f do
In that case, there is no issue with returning results, as the value of
the last statement executed is returned, or undef is returned if the
file can't be read or compiled, with either $! or $@ receiving the
error, depending. You will probably want to return something other than
undef if the code was properly executed.