in reply to System call doesn't recognise '>'

You don't show your code, but I'm guessing you're using the system LIST form - you could try catenating the arguments into a single string and passing that to system e.g. instead of system $arg1, $arg2, $arg3;, try either system $arg1 . $arg2 . $arg3;, or system "$arg1 $arg2 $arg3";.

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: System call doesn't recognise '>'
by Lauras (Initiate) on Dec 10, 2008 at 14:16 UTC
    Indeed, I used 'system LIST'
    I already tried to add all arguments as one, and even tried to add as an array:
    @array = ($command, "$arg1 $arg2 > outfile")
    system(@array)
    Or also:
    @array=($command, $arg1, $arg2, "> outfile")
    Or also:
    @array=("$command $arg1 $arg2 > outfile")
    In the last case it didn't even recognise $command, and in the previous cases it tried to open '>' as a possible argument (=backgroundfile)
      What happens if you make the call read: system("$command $arg1 $arg2 > outfile") ?

      Note that, on Windoze, the arguments for system are the same as for exec. However, exec isn't, or wasn't, fully supported on Windoze, I think you might have to use the single string form of the call, so in your case, something along the lines of...

      my @array = qq/$command $arg1 $arg2 > outfile/; system "@array"; # Use perl to stringify the command argument list
      Just a thought...

      A user level that continues to overstate my experience :-))
        my @array = qq/$command $arg1 $arg2 $arg3 > $outfile/; system "@array";

        Resulted in: Can't spawn "cmd.exe": No such file or directory at D:\advanced_programming\test_syscall.pl line 10.

        On the other hand:

        my @array = ($command, "$arg1 $arg2 $arg3 > $outfile");

        system (@array);

        Results in:

        Clover: Cis-eLement OVERrepresentation Compiled on Jul 18 2006 Error: motif and sequence files required Usage summary: clover [options] mymotifs myseqs.fa [BGfiles]