use strict; use warnings; use feature 'say'; use SQL::Abstract; my $input = 'Orlando Miguel Jose Fernando'; my @match = map { +{ 'like' => qq{'%$_%'} } } split ' ', $input; my %where = ( Name => [ -and => @match ] ); my $sqla = SQL::Abstract->new; my ($sql, @bind) = $sqla->select('People', undef, \%where); say $sql; say for @bind; __END__ #### $ perl 1208017.pl SELECT * FROM People WHERE ( ( Name LIKE ? AND Name LIKE ? AND Name LIKE ? AND Name LIKE ? ) ) '%Orlando%' '%Miguel%' '%Jose%' '%Fernando%'