in reply to Re: Re: Word Evaluation
in thread Word Evaluation
'\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.# 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
|
|---|