Re: Grep question

[email protected] (Steve Bertrand)
Newsgroups perl.beginners
Message-ID <[email protected]>
David Gilden wrote:
> Could someone please help me the syntax here....
> 
> 
> my $Comments = param('(Comments');
> &BADemail if ($Comments =~ /[virtualthirst.com|napavalleycf.org]/ig);
> 
> This should go to  &BADemail if $Comments contains either string, regardless 
> else is contained in the $Comments.

In a response I received on this thread:

http://www.nntp.perl.org/group/perl.beginners/2008/06/msg101141.html

...in particular, I learned from John that:

"The '|' which is used for alternation outside of a character class just 
matches a literal '|' character inside a character class...."

You need to remove the character class '[' and ']' from your statement, 
or else you are trying to find a '|' literally within $Comments.

Regards (thanks!),

Steve
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.