Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: wantarray propagation?by John M. Dlugosz (Monsignor) |
on May 20, 2011 at 19:58 UTC ( [id://905962]=note: print w/replies, xml ) | Need Help?? |
Indeed. You can use scalar foo(...) to force foo to be called in scalar context. I think using the function on a line by itself, without using the return value, will give void context. The reason it is not the case in your example is because test() is the last line in the function test2, and is an implicit return statement. You are actually saying return test() which propagates test2's context. Write test(); return; instead.
In Section
Seekers of Perl Wisdom
|
|