I think to have associated the file type on the command line, something like this happened:
C:\>ASSOC .pl=PerlScript FTYPE PerlScript=perl.exe %1 %*
system("dir") == 0 or die "system failed: $? , $!, $^E";
gives:
C:\mydir\>test.pl > test.out
system failed: 65280, No such file or directory, %1 is not a valid Win32 application at C:\mydir\test.pl line 3.
I think that the problem is that a new shell is invoked from within the perl script, and the output of 'dir' can't make it back due to quirks in the ActivePerl implementation:
http://perlhelp.web.cern.ch/PerlHelp/faq/Windows/ActivePerl-Winfaq5.html
I agree with the above; gotta use pl2bat.