In fact, often I see <...> used in array context immediately followed by a foreach loop iterating over the array, and it makes me cringe.Or immediately preceded by map?
In fact I have a trivial wrapper MyIO script where I canopen my $fh, q{<}, q{stop_words.txt} or die qq{cant open stop: $!\n}; my %stop = map{chomp; $_ => undef} <$fh>;
and latermy @array = $io->read_array(q{smallish_file});
There are a couple for strings too (and for returning a hash). If it isn't a 'big' file, say an Apache access log, I never bother with file handles. They are always an intermediate step I could do without.$io->write_array(q{tweaked_file}, \@array);
About the only file handle I use regularly is <DATA> because it is handy when posting on PerlMonks. :-)
In reply to Re^2: Using a loop to process multiple files
by wfsp
in thread Using a loop to process multiple files
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |