I found that on Windows (using ActiveState Perl 5.10)
the command
perl -e "system('type myfile.txt')"
result in a "File not found" message, while
perl -e "system('cmd /c type myfile.txt')"
perl -e "system('cat myfile.txt')"
- the latter being the Windows port of the Gnu
utilities - work as expected.
My first explanation was that
cmd.exe is bypassed in the first case, and since
type is an internal command, it can't be executed
that way. This explanation, however, can't be correct,
because Windows doesn't complain about 'type' not
being found, it complains about myfile.txt. Also,
perl -e "system('dir ...')"
works fine, although
dir is an internal
command as well. Does anybody know why
type
is so special? I'm asking this out of curiosity,
because in a real application, I would not shell
out to type a file, but do it directly from Perl.
--
Ronald Fischer <ynnor@mm.st>