in reply to Re: Re: Word Evaluation
in thread Word Evaluation

If I understood right, you have a list of words in a string and you want to add a word to that string, the new word should not exist already in the words string, am I right till here? If yes then you should do as follows:
# suppose you have: $line = qw(advanture door tree); # and $word is: $word = 'ad'; ... if ($line =~ /\b$word\b/) { next; } else { # add $word to the list } # only if $word will be exactly 'adventure' or 'door' it will be skipe +d over
'\b' is a word boundry like a space a comma (anything that is not a-z, A-Z, 0-9 or '_'), so the regexp in the 'if' statement is exactly what you need.

Hotshot