Do you know where your variables are? | |
PerlMonks |
Re^3: wantarray documentation in 5.8.7by themage (Friar) |
on Jul 25, 2005 at 14:23 UTC ( [id://477833]=note: print w/replies, xml ) | Need Help?? |
wantarray, I thought, and your test would confirms it, depends on context, not scope.
But then, your do as block, with the code directly inside, like this:
Is always undefined, both in scalar, void or array context, and the same apply to wantarray called directly, like this:
The way I got it working as expected were in a sub, like this:
Is wantarray only trustable inside subs or even there it fails to return as expected anytime? I was expecting thet the context made the trick, but after see it fail when called directly, I wasn't expecting that the do block didn't work as the do EXPR (do 'filename.pl').
TheMage http://themage.bliker.com
In Section
Seekers of Perl Wisdom
|
|