Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: Comparing string to array elements

by Lotus1 (Priest)
on Jan 13, 2017 at 21:14 UTC ( #1179550=note: print w/replies, xml ) Need Help??


in reply to Re^3: Comparing string to array elements
in thread Comparing string to array elements

Why not

  • read in the terms.txt file into a scalar variable using slurp,
  • split that into an array of terms,
  • use a regex inside a foreach loop to test each term against your text?

The example I gave you was intended to point you in this direction. My example shows how to slurp a file into a scalar variable. Then split that with something like my @terms = split ' ', $terms_text.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1179550]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2018-07-19 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (414 votes). Check out past polls.

    Notices?