gri6507 has asked for the wisdom of the Perl Monks concerning the following question:
I have a need to read N files one line at a time and then manipulate those individual lines depending on their content. I was hoping to do something like this
use strict; use warnings; use English; print "Usage: $0 output input1 input2 ...\n"; my $outfile = shift @ARGV; open(OUT, ">$outfile") || die "Can't open $outfile for writing: $!\n"; my @infile; foreach (@ARGV) { open(IN, $_) || die "can't open $_ for reading: $!\n"; push @infile, \*IN; } foreach(@infile){ my $i = <$_>; print "Got: $i"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reading N files
by Fletch (Bishop) on Jul 19, 2006 at 14:33 UTC | |
by gri6507 (Deacon) on Jul 19, 2006 at 14:44 UTC | |
|
Re: reading N files
by polettix (Vicar) on Jul 19, 2006 at 14:42 UTC | |
|
Re: reading N files
by GrandFather (Saint) on Jul 19, 2006 at 17:36 UTC | |
by gri6507 (Deacon) on Jul 19, 2006 at 21:16 UTC | |
by graff (Chancellor) on Jul 20, 2006 at 01:37 UTC | |
by gri6507 (Deacon) on Jul 20, 2006 at 12:24 UTC | |
|
Re: reading N files
by Solo (Deacon) on Jul 19, 2006 at 15:13 UTC |