Piping data into Perl scripts from a MS DOS command line

If you have a Perl script that reads from STDIN like so:
cat file.txt | yourscript.pl

The above example will work fine in Linux/UNIX but will give the following error under a MS DOS prompt:

The process tried to write to a nonexistent pipe.

A quick way to fix this is to change your command line to:

type file.txt | perl yourscript.pl

Your script wil now work as it did in Linux/UNIX.

Note: Activestate Perl was used in Windows.

Last updated: 13/10/2005