if ( $b and $c ) { $string = "$a" . ' where ' . "$b" . ' and ' . "$c"; } elsif ( $b or $c ) { if ( $b ) { $string = "$a" . ' where ' . "$b"; } else { $string = "$a" . ' where ' . "$c"; } }