Re: Searching for a word in a file ....... need a faster way.

2006-07-04 Thread Mr. Shawn H. Corey
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 t

RE: Searching for a word in a file ....... need a faster way.

2006-07-04 Thread Jeff Peng
ref=eval "sub { $eval }"; die "can't eval: $@" if $@; return $ref; } Here @init strore the conditions of /search_pattern/. From: "kilaru rajeev" <[EMAIL PROTECTED]> To: beginners@perl.org Subject: Searching for a word in a file ... need a fas

Searching for a word in a file ....... need a faster way.

2006-07-04 Thread kilaru rajeev
Hi all, I'm searching for a word in a file. I wrote the code like this. while ( ) { if ( /search_pattern/ ) { executebale. } } or Can I use like, @list = ; grep();# using grep on list Let me know a faster way to search. Regards, Rajeev