in reply to DWIM Part Nineteen: Unary Operators in Void Context
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DWIM Part Nineteen: Unary Operators in Void Context
by CheeseLord (Deacon) on Aug 21, 2001 at 18:43 UTC | |
|
Re: Re: DWIM Part Nineteen: Unary Operators in Void Context
by dragonchild (Archbishop) on Aug 21, 2001 at 16:37 UTC | |
by maverick (Curate) on Aug 21, 2001 at 17:56 UTC |