Karyn Williams wrote:

> I need to check for strings in a file. An example would be checking for a
> username in /etc/passwd or /var/log/maillog. The string is in another
> file, sometimes a single field on a line by itself, sometimes in a line
> with other strings. Based on what I have seen online and what I have done
> in other scripts I can :
> 
> 
> 1. slurp the file into a single string and then check for a match.
> 
> 2. read the relevent field from the file into hash keys and check for a
> match.
> 
> 3. Loop through the file line by line and look for a match.
> 
> 
> Generally there are 1 - 2,000 strings, and 2,000 to 1,500,000 lines per
> file.
> 
> I am wondering how these different methods may impact performance.

perldoc -q "How do I efficiently match many regular expressions at once"



John

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


Reply via email to