in reply to pipe to script requires '| perl' on win32

The Command prompt (cmd.exe) will pipe information from one 'process' to a 'thing' where the target is either an executable (.exe, .com) or a batch file (.bat, .cmd). The key is that the target must be supported directly by CMD.exe without external help.

The command prompt will also 'do something' with any filename that you type in and press enter. The action carried out is the default action determined by the registry entries for the particular file extension. Normally this application is something that lets you view or edit the file. e.g. enter index.htm and IE loads the file.

In the example above, the current directory contains a file called myscript.pl. If you enter myscript.pl at the command prompt, the .pl extension is associated with Perl.exe and so the file will be sent to Perl.exe with myscript.pl as the first argument. Since the file happens to contain some instructions that Perl.exe can understand, Perl.exe carries out the instructions.

This behavior kind of makes Perl scripts look like programs in their own right since the default action sends them to Perl.exe and they do something. Perl.exe does it's own thing in the background and we kind of forget that it is running.

myscript.pl is however still just a file and not an executable. When you try and pipe the output from another program into the myscript.pl file then you don't get very far since you pipe into processes not files. If on the other hand you use the explicit Perl or PL2BAT route then you are piping into a process that has myscript.pl as it's first argument.