Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: OR sequence

by ikegami (Patriarch)
on Mar 21, 2008 at 22:38 UTC ( #675544=note: print w/replies, xml ) Need Help??

in reply to OR sequence

|| does not form a list of operands to pass to another operator. There's isn't such an operator in Perl5 (but I bet there is in Perl6). Of its two operands, it returns the first one that is true.

What you want is

if ( $FORM{'Comments'} =~ m/http|html|a href/i || $FORM{'addr'} =~ m/http|html|a href/i || $FORM{'name'} =~ m/http|html|a href/i )

You can remove the redundancy with a loop

for (@FORM{qw( Comments addr name )}) { if (m/http|html|a href/i) { html_message(); last; } )

Is there a reason you didn't apply my suggestion to change
/http|html|HTML|A HREF|a href/i
to the simpler and equivalent
/http|html|a href/i
That's what the "i" does.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://675544]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2023-10-03 23:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found