in reply to Re^2: System call doesn't recognise '>'
in thread System call doesn't recognise '>'

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 :-))

Replies are listed 'Best First'.
Re^4: System call doesn't recognise '>'
by Lauras (Initiate) on Dec 10, 2008 at 15:00 UTC
    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]
      Does the command work without redirection when run by system?

      A user level that continues to overstate my experience :-))
        For this code:
        my @array = ($command, $arg1, $arg2, $arg3); system (@array);

        It runs perfectly and returns the output to StandardOUT

        Clover: Cis-eLement OVERrepresentation Compiled on Jul 18 2006 Getting raw scores... Reading background sequences... Analyzing background sequences... Getting motif locations... Sequence file: D:\advanced_programming\test.fa (3 sequences, 16050 bp, + 55.6% C+G) Motif file: D:\advanced_programming\motif.dat (2 motifs) *** Over- and Under-represented Motifs: Motif Raw score P-value from randomizing background *** Motif Instances with Score >= 6: Motif Location Strand Sequence Score Background sequence files: D:\advanced_programming\background.fa (2 sequences, 284279 bp, 37.3% + C+G) Randomizations: 1000 P-value threshold: 0.01 Motif score threshold: 6 Randomize nucleotides OFF Randomize dinucleotides OFF Randomize motifs OFF Lowercase filtering OFF Pseudocount: 0.375 Random seed: 1

        This on the other hand:

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

        Returns:

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