On Mon, Apr 26, 2004 at 10:14:51AM -0500, Eric Lease Morgan wrote:
>   %>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?

Try using the magic filehandle. So in foo.pl :

    while ( defined( $line = <> ) ) { 
        ...
    }

The magic filehandle will read stuff from @ARGV and will also read from
STDIN.

//Ed

        
> 
> -- 
> Eric Lease Morgan
> (574) 631-8604
> 
> 

-- 
Ed Summers
aim: inkdroid
web: http://www.inkdroid.org

We act as though comfort and luxury were the chief requirements of life, when all that 
we need to make us happy is something to be enthusiastic about. [Einstein]


Reply via email to