Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: testing parts of a string against a word database

by TJPride (Pilgrim)
on Dec 01, 2011 at 01:45 UTC ( #940988=note: print w/replies, xml ) Need Help??

in reply to testing parts of a string against a word database

use strict; use warnings; my (%words, $c); ### Contains words 'apple' and 'cart' open (HANDLE, 'words.txt'); while (<HANDLE>) { chomp; $words{uc $_}++; } while (<DATA>) { $c++; while (m/([A-Z']+)/ig) { print "[$c] $1 is a noun.\n" if $words{uc $1}; } } __DATA__ Jared ran forward. He picked up an apple. He put the apple in the cart.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://940988]
[Eily]: and congratulations :P
[choroba]: Eily++ # made the smiley on his face instead of in the message
[LanX]: weekend ... and waiting that chacellor choroba finally catches up ;-p
LanX last weekend or the one before (???)
choroba needs more questions to provide answers to
jedikaiti looked at last hour of CB, saw "boos" but read "boobs"

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2017-09-20 15:56 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (237 votes). Check out past polls.