jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:

Looking at http://perldoc.perl.org/functions/system.html and the docs on my own installation I find no reference to putting a 1 as the first parameter of a system call. I am using it like this:
system(1, $progname);
So that I do not have to wait for hte external programme to return.

Where is this documented?

jdtoronto

Replies are listed 'Best First'.
Re: system() not quite as described?
by xdg (Monsignor) on Jun 22, 2006 at 18:01 UTC

    Are you on Win32 by any chance? I've seen this documented in perlport:

    As an optimization, may not call the command shell specified in $ENV{PERL5SHELL}. "system(1, @args)" spawns an external process and immediately returns its process designator, without waiting for it to terminate. Return value may be used subsequently in "wait" or "waitpid". Failure to spawn() a subprocess is indicated by setting $? to "255 << 8". $? is set in a way compatible with Unix (i.e. the exitstatus of the subprocess is obtained by "$? >> 8", as described in the documentation). (Win32)

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Thanks xdg about the only place I didn't look! But then I am usually daunted by perlport.

      jdtoronto

Re: system() not quite as described?
by Joost (Canon) on Jun 22, 2006 at 18:03 UTC
        What the advantage of doing this instead of using fork?