in reply to Annoying system() limitations

Perhaps you should look at Why can't I get the output of a command with system()?

Ok maybe that's not so helpful, and maybe NT can return more than a seven bit return code (I don't know), but I ran this on Unix:
perl -e 'exit 304' || echo $? # and for the fun of it: awk 'BEGIN {exit 304}' || echo $?
and it printed '48' in both cases so there is definitely a 7 bit limitation here.

Replies are listed 'Best First'.
Long Ramble about my options
by Anonymous Monk on Jan 18, 2001 at 00:50 UTC
    Hrm..

    Well that's frustrating.. I'm not sure what to do about this..

    Some ideas:

    • Redirect the output to a file; read the file .(e.g.,
      system("$program $paramlist > file.txt");
      This might work in the general case, but this particular REXX script ("fmtscan()")I'm calling doesn't generate output. It only returns a value. I couldn't change that without breaking all the REXX programs that call it.

    • Change fmtscan() to return a string instead of a numeric value. This would work fine since everything is a string in REXX, and it seems there must be a way to do that in Perl... but I don't know what that way is.

    • Rewrite fmtscan() in Perl, itself! Sounds fun, sounds like a learning experience... sounds like I'll finally have to learn to build a module. About damn time, I say.
      Check perlman:perlop for the qx operator (way at the end under "quote-like" stuff). This may do what you want.