Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Search Algorithm

by t0mas (Priest)
on Aug 10, 2000 at 17:42 UTC ( #27285=note: print w/replies, xml ) Need Help??

in reply to Search Algorithm

From perldoc -f study:
The following scans a list of files (@files) for a list of words (@words), and prints out the names of those files that contain a match: $search = 'while (<>) { study;'; foreach $word (@words) { $search .= "++\$seen{\$ARGV} if /\\b$word\\b/;\n"; } $search .= "}"; @ARGV = @files; undef $/; eval $search; # this screams $/ = "\n"; # put back to normal input delimiter foreach $file (sort keys(%seen)) { print $file, "\n"; }
Is this what you want?
Anyway, undef $/ will be faster than line by line.

/brother t0mas

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://27285]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2016-10-25 17:33 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (326 votes). Check out past polls.