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

Hi fellow Monks, While attempting to use the System function to execute a Win32 system command on Windows XP such as 'fsutil', I continue to get a failure. I can execute it on the command line with no problem. I have tried, both, system, exec and assigned it as a Filehandle. Any thoughts?

use strict; @Logs = ("c:\\defaultNew3.log","c:\\logit.log"); system "fsutil", "hardlink", "create", @files;

Replies are listed 'Best First'.
Re: system function
by ysth (Canon) on Mar 27, 2008 at 04:35 UTC

      Global symbol "@files" requires explicit package name at linker.pl line 3. Global symbol "@files" requires explicit package name at linker.pl line 5. Execution of linker.pl aborted due to compilation errors.

        That error has nothing to do with system; it tells you you haven't declared @files.

        In the code you show, you are setting @Logs but then trying to use @files. Since you didn't get an error on @Logs, I presume you declared it, and where you have @files you should change it to @Logs.

Re: system function
by ikegami (Patriarch) on Mar 27, 2008 at 12:09 UTC
    What's the return value of system? And if the return value of system is -1, what's the value of $! after calling system?
Re: system function
by BrowserUk (Patriarch) on Mar 27, 2008 at 05:31 UTC