http://qs321.pair.com?node_id=182598

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

if(param("des") || param("title") =~ m[\|]) { &inerror("You cant include |'s in your text"); }
This doesnt work, all I want do is check to see if they contain vertical bars

Replies are listed 'Best First'.
Re: search for vertical bars
by DamnDirtyApe (Curate) on Jul 17, 2002 at 22:03 UTC

    I think what you mean to say is:

    if(param("des") =~ m[\|] || param("title") =~ m[\|]) { &inerror("You cant include |'s in your text"); }

    _______________
    D a m n D i r t y A p e
    Home Node | Email
Re: search for vertical bars (Russ was bored)
by Russ (Deacon) on Jul 18, 2002 at 00:04 UTC
    Just because I cringe at duplicated code (and my duplicate threshold is very low ;-)

    Nothing at all wrong with DamnDirtyApe's answer... Like the title says, I was bored and just had to post.

    if (grep {/\|/} (param('des'), param('title')){ # at least one of them matched }

    Russ
    Brainbench 'Most Valuable Professional' for Perl

A reply falls below the community's threshold of quality. You may see it by logging in.