in reply to Looking for neater solution with dynamic query
#!/usr/bin/perl -wT use strict; use CGI qw|:standard :debug|; my $sql_that_i_dont_know = 'select foo from foo where donkeys="fly"'; my $connector = 'where'; #by default if($sql_that_i_dont_know=~m/where/){$connector = 'and'}; for(qw|component env|){ next unless CGI::param($_); $sql_that_i_dont_know .= qq| $connector upper($_) | . q| = "| . uc(C +GI::param($_)) . q|"|; } print $sql_that_i_dont_know; 1;
Celebrate Intellectual Diversity
|
|---|