fix perl #115078, ternary folding logic failure