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

Dear monk I need again some assistance.
Following line works fine:
exec($musclepath, "-in $inpath -out $outpath -stable") == 0 or die $?;
But if I use "system" insted of "exec" I am told that my imputline is not correct and I see no "-" in front of the "in". Why is it so? I am in need of "system" because it is a loop and needs to return and work again. Thank you very much.

Replies are listed 'Best First'.
Re: system does not work but exec. why?
by merlyn (Sage) on Nov 12, 2005 at 20:52 UTC
    Your exec is probably failing in the same way, but something is keeping you from seeing the error. When you use multiple arguments like that, you are responsible for doing your own argument breakup. Whitespace is no longer significant. Perhaps you want:
    system $musclepath, "-in", $inpath, "-out", $outpath, "-stable"; if ($?) { ... something broke, deal with it ... }

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      I knew the wisdom in this temple is unquestionable. It works perfect. Thank you very much.