http://www.perlmonks.org?node_id=906191


in reply to How to process multiple input files?

As written, the <> construct will read from each file name given on the command line, in turn. You don't need to do anything else; just list more than one file on the command line.

Replies are listed 'Best First'.
Re^2: How to process multiple input files?
by rnaeye (Friar) on May 22, 2011 at 20:08 UTC

    It only processes first file in the command line.

      Ah, you are only reading once. I see what you were asking now.

      Making a while loop out of it like so:

      my $line; while (defined ($line = <>)) {
      will repeat until there are no files left.