Jeff Peng wrote:
> Because the latter (grep) is essentially a loop,so grep() is not better
> than using 'while(<>)'.Specially,when the file's size is large,reading
> all the contents of this file into an array would consume your memory
> quickly.
>

Another way to speed things up is to pre-filter the file:

grep 'a_simple_pattern' data_file | my_script

The *NIX grep(1) is normally much faster than Perl's grep.


-- 
__END__

Just my 0.00000002 million dollars worth,
   --- Shawn

"For the things we have to learn before we can do them, we learn by
doing them."
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to