in reply to ternary operator

The previous two posts show how to use the ternary operator to assign a value to a variable, but neither mentioned that your lc statement wasn't working as you intend. The lc function will use $_ as an argument if none is provided, but it returns the lowercased string. Since you never assign the return value to anything, it gets ignored (this would have been evident if you used warnings). To fix it, reassign to $_:

print "[$_]\n"; # S lc( $_ ); # warning: "Useless use of lc in void context" print "[$_]\n"; # S $_ = lc( $_ ); print "[$_]\n"; # s