There are a lot of things to consider...
- `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.
- 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).
- 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):
- To get the output into a variable: $result=`/path/to/test -params`;
- To just execute it (sending output to STDOUT, STDERR): system('/path/to/test','-param1','-param2');
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