my $table = "some_table"; my $columns = "foo,column2,another_col"; my $where_cond = "foo like '%bar%'"; $where_cond .= " and column2<4"; my $sql = "select $columns from $table where $where_cond";