in reply to Naming file handles with variables?
But I suspect that that your application needs something more efficient, as the presented solutions preseted up to now cause many disk seeks. Ignoring caches there is a seek for each line of each file!my $command = 'paste ' . join(' ', @ARGV); open FH, $command .'|'; while <FH> { @one_line = split "\t", $_; # do something }
I'd 'slurp' all files into an @array[file_no][line_no] one after another. This is done linear and at once. If the array does not fit into RAM, I'd use Tie::File. See e. g. http://www.sysarch.com/Perl/slurp_article.html
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Naming file handles with variables?
by GrandFather (Saint) on May 01, 2009 at 07:38 UTC |