Hello mrityunjaynath,

To elaborate a little on Anonymous Monk’s answer: the call to `qcmd.bat $toplevelentity` is itself “interpolated and then executed as a system command with /bin/sh or its equivalent.” (perlop) The standard output of this command is then passed to system, which attempts to run this “command” (whatever it is) as another system call. As Anonymous Monk says, you need double quotes (or qq()) here, not backticks (qx()). Alternatively, drop the call to system and just use the backticks:

if ($choice eq "y") { `qcmd.bat $toplevelentity`; } else {

But note that, in this case, the (standard) output of the system call will be thrown away, unless you explicitly assign it to a variable or print it. If you call system, standard output goes to the console and only the command’s exit status is returned to the Perl script.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re: error: can't spawn "cmd.exe" by Athanasius
in thread error:cant spawn "cmd.exe" by mrityunjaynath

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.