Let's assume that script1.pl calls script2.pl and script1.pl has to evaluate the exit status of script2.pl.
This is script1.pl:
#!/usr/bin/perl -w # # this is script1.pl # if( system( "perl script1.pl")) { print "script1.pl was not successful\n"; }
This is script2.pl:
#!/usr/bin/perl -w # # this is script2.pl # my $status = 1; if( SomethingWentWrong) { print "something went wrong\n"; $status = 0; goto finish; } finish: exit !$status;