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

my @array = ($command, $arg1, $arg2, $arg3); system( "@array > $outfile" ) == 0 or die "Couldn't launch [@array > $outfile]: $!/$?";

Results in:

Can't spawn "cmd.exe": No such file or directory at D:\advanced_progra +mming\test_syscall.pl line 29. Couldn't launch [C:\clover\clover.exe D:\advanced_programming\vb_van_m +otif.dat D:\advanced_programming\test.fa D:\advanced_programming\back +ground.fa > C:\clover\out.txt]: No such file or directory/65280 at D: +\advanced_programming\test_syscall.pl line 29.

Again: If I paste the string C:\clover\clover.exe D:\advanced_programming\vb_van_motif.dat D:\advanced_programming\test.fa D:\advanced_programming\background.fa > C:\clover\out.txt in command line cmd.exe , it returns perfect output to the out.txt file.

Replies are listed 'Best First'.
Re^5: System call doesn't recognise '>'
by Corion (Patriarch) on Dec 11, 2008 at 09:15 UTC

    Perl starts all programs through cmd.exe (or whatever the local shell is) when it finds one of <>| in the command to execute. As we've established, cmd.exe is not in your path. You won't be able to launch any program with redirection through system until you fix that. Also read system which also tells you that.

      You're right.

      And I did read the system documentation - but I couldn't deduce that from it... Must be my inexperience