- So 2.pl might return anything.
- You can't do anything about that
- On success 2.pl returns WTF it feels like (see 1)
- And you want me to let *you* know the range of values that will be returned when the script is executed successfully and the range when it's failure
Sorry. Computer says no. Does not compute.
Maybe try backtics
$output = `perl 2.pl`;
if ($output =~ m/some random error message/) {
die "Computer says no";
}
Alternatively look up do and wrap that in an eval. This is archaic but is probably what you want.
eval{ do '2.pl' };
die "Aaaagh! $@" if $@;