change system(@Call) to system("@Call"); and it will work.

[jconner@kwan ~]$ perl -e ' @Call[0] = "gawk"; @Call[1] = "-f"; @Call[2] = "test.gawk"; @Call[3] = "test.file"; @Call[4] = ">"; @Call[5] = "out.file"; print "system(@Call)\n";'

prints: system(gawk -f test.gawk test.file > out.file)
which wouldn't even work if you literally placed it that way in a script. However, If you ran this: system("gawk -f test.gawk test.file > out.file") in a script that would work. So, therefore, enclose your array in the system() call in quotes. It works. :)

[jconner@kwan ~]$ ls -l out.file gls: out.file: No such file or directory [jconner@kwan ~]$ perl -e ' @Call[0] = "ls"; @Call[1] = "-al"; @Call[4] = ">"; @Call[5] = "out.file"; system("@Call");' [jconner@kwan ~]$ ls -l out.file -rw-r----- 1 jconner other 4637 Oct 23 10:56 out.file [jconner@kwan ~]$

----------
- Jim


In reply to Re: Array for system() call by snafu
in thread Array for system() call by proxima

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.