Mark Lobue wrote: > > -----Original Message----- > > From: LoBue, Mark [mailto:[EMAIL PROTECTED] > > Sent: Monday, July 21, 2003 9:26 AM > > To: '[EMAIL PROTECTED]' > > Subject: STDIN and STDOUT on Windows > > > > > > Hello, > > > > I normally use perl on a unix platform, but I needed to run a > > quick utility > > on a Windows PC. Normal stdin and stdout doesn't seem to > > work, take this > > simple program: > > > > # > > use warnings; > > use strict; > > > > while (<>) { > > print; > > } > > > > On Windows, if I run: > > type test.txt | test.pl > > I get: > > The process tried to write to a nonexistent pipe. > > or > > test.pl < test.txt > > I get nothing at all. Any tricks to using stdin and stdout > > on Windows or do > > I have to explicitly open files on that platform? > > > Ok, I just found the trick, the registration of the .pl doesn't > handle this case, I have to run: > type test.txt | perl test.pl
We Unix people find we Windows people very strange :) Windows' handling of pipes and redirections is only vaguely comparable to Unix. In fact, whether you are running 'cmd.exe' or 'command.com' makes a big difference, and not just what you'd expect from a change of shell. One the other hand, Windowers would wonder why (sorry, no more 'W's) anybody would either pipe or redirect an input file to its destination program. Think "Run <the interpreter> on file <input file> using input files <file1> <file2> .. test.pl < test.txt and type test.txt | perl test.pl are just two (increasingly weird) versions of perl test.pl test.txt HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]