in reply to Re: Start an MS window in background from a perl script
in thread Start an MS window in background from a perl script

& is a sh thing

But, in a sense, that's an oversimplification. I mean, if I run (in Cygwin's bash shell):
Rob@desktop2 ~ $ perl -e 'system "notepad &"'
then that works as intended. But if I invoke ActivePerl (in the very same Cygwin shell) by running:
Rob@desktop2 ~ $ /cygdrive/c/_32/ap822/bin/perl -e 'system "notepad &"'
then I get the precise (undesired) behaviour as described by the op - where I get told that &.txt does not exist.

Is it simply a case of "ActivePerl always assumes that it's being run in the cmd shell" ? ... or is there a more erudite way of explaining this ?

Cheers,
Rob

Replies are listed 'Best First'.
Re^3: Start an MS window in background from a perl script
by ikegami (Patriarch) on Sep 19, 2007 at 14:48 UTC

    There's no assumption being made as to which shell launched Perl. As documented, the shell used by system is constant.

    On most platforms, that shell is /bin/sh (no matter what the user's login shell is or which process launched perl), so system's argument must be a sh command. & can be used to run a background task in sh.

    On Windows (cygwin aside), that shell is cmd, so system's argument must be a cmd command. start can be used to run a background task in cmd.