How do I get a Perl program to accept input from STDIN as well as command line input.


I have a program (foo.pl) that is designed to read the contents of @ARGV and process each item in the array. Tastes great. Less filling. So, when I do something like this, things work just fine:

%>foo.pl a b c d e f g

I have another program (bar.pl) that prints to STDOUT. The output is the same sort of data needed by foo.pl. So, I thought I'd give this is a whirl:

%>bar.pl | foo.pl

But alas, foo.pl never seems to get the input sent from bar.pl. It does not seem to read from STDIN.

What should I do to my first program (foo.pl) so it can accept command line input as well as input from STDIN?

--
Eric Lease Morgan
(574) 631-8604



Reply via email to