Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: if/else options

by busunsl (Vicar)
on Aug 20, 2009 at 11:37 UTC ( [id://790065]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @where;
    my $sql = 'select * from table';
    ...
    push @where, 'column3 = "' . $var3 . '" ' if defined $var3;
    
    $sql = $sql . ' where ' . join(' and ', @where);
    
  2. or download this
    my @values = (undef, $var1, $var2, $var3);
    my @where;
    ...
    }
    
    $sql = $sql . ' where ' . join(' and ', @where);
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-16 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found