in reply to command-line arguments and @ARGV

What happens if you try:

system qq[ start /b /wait /low perl C:/Perl_activate/Run_this.pl $var +] and print STDERR "couldn't exec the perl program: $!";

You can probably[1] avoid an unnecessary shell process by using:

my @cmd = qw[ start /b /wait /low perl C:/Perl_activate/Run_this.pl ]; system @cmd, $var;

See perldoc system for more details.

[1] I say "probably" because I have no idea whether this trick works on Windows.

Update: Changed logical operator. Thanks to shmem for spotting it.

Replies are listed 'Best First'.
Re^2: command-line arguments and @ARGV
by shmem (Chancellor) on Jan 30, 2007 at 12:20 UTC

    Hmm...

    system qq[ start /b /wait /low perl C:/Perl_activate/Run_this.pl $var +] or print STDERR "couldn't exec the perl program: $!";

    Is system on Windows so much different that it returns a non-zero value on success (i.e. do Windows commands successfully exit with a non-zero status)?

    Otherwise, that should be

    system qq[ start /b /wait /low perl C:/Perl_activate/Run_this.pl $var +] and print STDERR "couldn't exec the perl program: $!";

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
A reply falls below the community's threshold of quality. You may see it by logging in.