UPDATE 2: As CheeseLord points out below I was on the right track ... so maybe don't ignore this post completely :) - anyway ++CheeseLord for the interesting idea
UPDATE: and the problem with me is that I post without testing and thinking properly. Ignore this post, lc is called in void context!! Thanks for making me think straight again dragonchild, I'm the one who's stupid ;-)
The problem with your suggestion is that it's not always so easy to see what's in void context and what's not. Consider for example this code with your version of lc:
The big problem is that the lc call is now not in void context - although it may look like it at first glance ...sub lc_and_chomp { chomp $_[0]; lc $_[0]; # is it in void context??? } my $var = "fOobAR\n"; lc_and_chomp($var); # this alters $var print $var;
-- Hofmator
In reply to Re: DWIM Part Nineteen: Unary Operators in Void Context
by Hofmator
in thread DWIM Part Nineteen: Unary Operators in Void Context
by CheeseLord
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |