Re: Reading from pipe or from stdin, how?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

In article

Quoted text here. Click to load it

The null file handle <> has just that behavior. See 'perldoc perlop'
and search for "I/O Operators".

You can use the following while loop in your program:

  while(<>) {

to do what you want. The elements of @ARGV are used as file names to
read. If empty, standard input will be read. You can also use "-" as a
file name to read standard input. You can manipulate the contents of
@ARGV before the loop to specify the files to read.

Jim Gibson

Site Timeline