KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to create something in Perl that is basically like the Unix tee command. I'm trying to read each line of STDIN , run a substitution on it, and print it. (And eventually, also print it to a file.) This works if I'm using console input, but if I try to pipe input to the command it doesn't do anything. Here's a simple example: print "about to loop\n"; while(<STDIN>) { s/2010/2009/; print; } print "done!\n"; I try to pipe the dir command to it like this: C:\perltest>dir | mytee.pl about to loop done! Why is it not seeing the piped input? (I'm using Perl 5.10.0 on WinXP, if that is relevant.)
Tags (comma-separated)
Save Edits
Cancel