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

In UNIX system() does the work of calling system commands but in Windows environment system doesnt work not evn syscall.Does it????

Replies are listed 'Best First'.
Re: System calls
by haoess (Curate) on Jun 09, 2004 at 10:22 UTC

    Please show your code and explain what you expect it to do.

    There's a fundamental difference between system and syscall. syscall does not work on Windows environments (see perlport).

    -- Frank

Re: System calls
by coldmiser (Hermit) on Jun 09, 2004 at 14:42 UTC
    In windows, system calls can be done in two ways:
    system("c:\\winnt\\system32\\calc.exe");
    or
    $output = `c:\\winnt\\system32\\calc.exe`;

    NOTE: In windows you have to use double back slashes to get into the proper directories, or you can use forward slashes to replace them. (ie. c:/winnt/system32/calc.exe)

      You'll find that File::Spec is your friend and takes all the worry out of remembering about slashes, back slashes etc.

      -- vek --
        Who worries about it? I just do it!