my $query = <<"ESQL"; SELECT * FROM $table WHERE $description_field LIKE '%$search_term%' and $start_time_field between ? and ? or $end_time_field between ? and ? ESQL #### use Time::Local; # . . . #### my @datetime_start = $date1 =~ /\d+/g; $#datetime_start = 5; # expand to six elements, # even if there are only three my @datetime_end = $date2 =~ /\d+/g; $#datetime_end = 5; # expand to six elements, # even if there are only three #### my $datetime_start = timelocal reverse @datetime_start; my $datetime_end = timelocal reverse @datetime_end;