http://qs1969.pair.com?node_id=692696


in reply to Re: system command
in thread system command

Hi,
I cant ensure having a return stmt in 2.pl.

There are many other scripts which has to be included in 1.pl which are legacy and I cant modify that.

But when 2.pl executes and if it's successful usually a perl script should return a range of value.

Let me know the range of values that will be returned when the script is executed successfully and the range when it's failure.

Replies are listed 'Best First'.
Re^3: system command
by tachyon-II (Chaplain) on Jun 18, 2008 at 14:05 UTC
    1. So 2.pl might return anything.
    2. You can't do anything about that
    3. On success 2.pl returns WTF it feels like (see 1)
    4. 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 $@;