Re: Matching at least $x words out of @words

"A. Pagaltzis" <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <20050509100612.GA16137@klangraum>
* Sven Neuhaus <[email protected]> [2005-05-09 10:35]:
> @a = $x =~ /word1|word2|word3/g;
> $count = scalar @a;

The problem with this and all the grep solutions is that you
don’t know whether you matched the same alternate multiple times,
or matched different alternates. You don’t know whether the
result is "2" because the string was "word1word1" (which should
be rejected) or "word1word2" (which we want to accept).

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.