in reply to system() not quite as described?

That doesn't work at my machine at all.

perl -e'system(1,"/usr/bin/xterm") and die' Died at -e line 1.
While
perl -e'system("/usr/bin/xterm") and die'
Does open an xterm window.

update: xdg found the correct answer: that construct only works on Win32.

Replies are listed 'Best First'.
Re^2: system() not quite as described?
by jdtoronto (Prior) on Jun 22, 2006 at 18:10 UTC
        It's used by core module IPC::Open3 (and Open2) instead of fork+exec when used on Windows.
      What the advantage of doing this instead of using fork?

        Why bother cloning an entire process if the next thing you are going to do is overwrite it by loading another program?

        The system 1, 'other.exe' only works on Win32. Win32 does not have the concept of forking in the OS, and Perl's fork is an emulation of that concept implemented using a thread. Unfortunately, the emulation does not quite live upto the functionality of *nix fork.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.