There are a lot of things to consider...

  1. `test` returns the output of the execution of "test", so your code is (trying to) run "test" and assigns all of its output to $execute; system executes the given command, so your code proceeds to (try to) run whatever "test" returned (oh, and "$var" is the same as $var). I take it that this is not what you are trying to do.
  2. In a normal, command-line environment, you have a list of directories to search for executables (it's usually the variable PATH, accessible from Perl as $ENV{PATH}). In a CGI environment, this list is usually empty, so if you want to execute a program you must specify the entire path (even if it is in the same dir as the CGI script).
  3. The CGI script is executed as the same user as the HTTP server, so it has different privileges than you. Keep this in mind when assigning permissions to your scripts/programs/files etc.

Now, short answers (use the one that is most appropriate):

For more details (like how to redirect input/output, how to get into troubles with multiple variable expansion, etc) consult perlop (qx is the same as ``) and perlfunc (system)

-- 
        dakkar - Mobilis in mobile

In reply to Re: execution of a C program by dakkar
in thread execution of a C program by navarrard

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.