Re: Grep question
[email protected] ("John W. Krahn")
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
Steve Bertrand wrote:
> 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...."
Also duplicate characters are ignored so the character class
[.acefghilmnoprstuvy|] matches the same character (and only one
character) as the character class [virtualthirst.com|napavalleycf.org]
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall