my $SQL = q{SELECT SongTitle, SongPath FROM Songs WHERE }; $SQL .= join('OR', map { '(Songs.Artist LIKE ?)' } @inc_artists); my $DBO = DBI->connect("dbi:SQLite:$mediaMonkeyPath", "", "") or die "Couldn't connect to MediaMonkey - $DBI::errstr\n"; my $STO = $DBI->prepare($SQL); my $results = $STO->execute( map { "\%$_\%" } @inc_artists);