my @sources = ( 'artist 1', 'artist 2', 'whatever' ); ### we make an array first... my @values = map { s/([_%])/\\$1/g; "%$_%" } @sources; ### ...to avoid an error here my $like_clause = join( " or ", map { "Songs.Artist LIKE ?" } @values; my $sth = $dbh->prepare( "SELECT * FROM Songs where ($like_clause)" ); $sth->execute( @values );