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

Re^2: Words in Words

by sarchasm (Acolyte)
on Sep 30, 2011 at 21:45 UTC ( #928930=note: print w/ replies, xml ) Need Help??


in reply to Re: Words in Words
in thread Words in Words

I may not have clarified the specs as well as I had hoped.

The results should be a distinct list of the words in the list that can be found contained within another word in the list taking into consideration the exclusions I listed.

When I run this code, it returns words that are not contained in the wordlist. They are just pieces of the word.

I will say that it is pretty fast though and I may be able to use this technique to get what I am looking for.

Thank you.


Comment on Re^2: Words in Words
Re^3: Words in Words
by choroba (Abbot) on Sep 30, 2011 at 23:31 UTC
    When I run this code, it returns words that are not contained in the wordlist. They are just pieces of the word.
    Have you changed the path to the input file? The code should only print words from the list!

      I did change the path but it looks like the code is substringing words through itself. Here is what I get:

      p in pogy's po in pogy's pogy in pogy's o in pogy's og in pogy's g in pogy's gy in pogy's gy's in pogy's y in pogy's y's in pogy's s in pogy's

      The process needs to look for the word "pogy's" within another word in the list like "apogy's"

        Are you sure "p", "po", "pogy" etc. are not on the list, too? If you are interested just in the words contained in other words, just declare the %found outside of the outermost loop and print only $subword.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-09-02 11:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (22 votes), past polls