Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: line by line match on an array of strings

by balaji_red83 (Acolyte)
on Jan 09, 2008 at 09:50 UTC ( #661295=note: print w/replies, xml ) Need Help??

in reply to line by line match on an array of strings

Instead of reading line by line, you can slurp in the contents of the entire file into a scalar variable and then look for a match against an array of strings.
local $/ = undef; open(FH,"<","test.txt") or die "Could not open the file due to $!"; my $fcontent = <FH>; close FH; foreach (@typedefs) { if ($fcontent =~ /$_/){ # perform various actions here if line match } }

Replies are listed 'Best First'.
Re^2: line by line match on an array of strings
by halley (Prior) on Jan 09, 2008 at 14:20 UTC
    Perhaps you missed this in the original post?
      with a few hundred thousand lines to search

    [ e d @ h a l l e y . c c ]

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://661295]
[zentara]: do you feel good about a non-open-source code, being in control of your display functions?
[choroba]: If you're not going to play 3d games on it, using the open source driver should be enough
[zentara]: choroba that is true, and the wise choice, but I want to see how fast I can get fglrx3dspheres to run... just as an intellectual challenge :-)

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2017-05-26 14:04 GMT
Find Nodes?
    Voting Booth?