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

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Actually I would think it comes out to the same number of if's but in a more readable format where you can see immediately which elements had to be true to force that query, either way I would recommend building the query on the fly if that is at all possible. Either way this is 25 lines instead of 70ish.

if ($1 && $2 && $3) { #a } if ($1 && $2) { #b } if ($1 && $3) { #c }

versus

if ($1) { if ($2) { if ($3) { #a } else { #b } } elsif ($3) { #c } }

I got a little bored and tried it out. Unless i screwed something up I think you are messing several combinations.

if ($name && $vorname && $plz && $tel && $tel49) { $qry = ""} elsif ($name && $vorname && $plz && $tel) { $qry = ""} elsif ($vorname && $plz && $tel && $tel49) { $qry = ""} elsif ($name && $plz && $tel && $tel49) { $qry = ""} elsif ($name && $vorname && $plz) { $qry = ""} elsif ($name && $plz && $tel) { $qry = ""} elsif ($name && $tel && $tel49) { $qry = ""} elsif ($vorname && $plz && $tel) { $qry = ""} elsif ($plz && $tel && $tel49) { $qry = ""} elsif ($name && $vorname) { $qry = ""} elsif ($name && $plz) { $qry = ""} elsif ($name && $tel) { $qry = ""} elsif ($name && $tel49) { $qry = ""} elsif ($vorname && $plz) { $qry = ""} elsif ($plz && $tel) { $qry = ""} elsif ($tel && $tel49) { $qry = ""} elsif ($plz) { $qry = ""} elsif ($name) { $qry = ""} elsif ($tel) { $qry = ""} elsif ($tel49) { $qry = ""} elsif ($vorname) { $qry = ""}

___________
Eric Hodges

In reply to Re^6: A Case with 5 Var's by eric256
in thread A Case with 5 Var's by ultibuzz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (4)
    As of 2014-07-26 06:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (175 votes), past polls