for(@$types) { if($_ eq $types->[-1]) { $sentence .= $matches>1 ? ' and ' : ' or ' } else { $sentence .= ', ' }