Perl IO redirection problems on Windows


On Unix I can run commands like " |" and have the output of be the input of This doesn't seem to work on Windows. How can I make this work?


The Windows command interpreter cmd.exe does not support IO redirection for programs started via shell associations, like those created for .pl files during the ActivePerl installation. It only works for .bat, .com, .cmd, and .exe files.

You need to write:

perl | perl

Or if the files are not in your current directory but are on the PATH:

perl -S | perl -S

Alternatively, you can wrap your .pl files into .bat scripts using pl2bat:


Then run them as:

a | b

This is also the case for > and <.