http://www.perlmonks.org?node_id=144938


in reply to checkbox

Here's a function which checks if a variable has data or not.Before firing an SQL statement, use this function on all the parameters being passed :
sub returndata_or_null { my $var = shift; $var =~ s/\'/\'\'/og; return ($str) ? "'$str'" : "null"; }