sub testc { if (defined wantarray() and not wantarray()) { print "scalar\n"; } elsif (defined wantarray() and wantarray()) { print "array\n"; } elsif (not defined wantarray()) { print "void\n"; } } my $x = testc(); my @x = testc(); testc();
In reply to Re: How do I check the return value of wantarray?
by mreece
in thread How do I check the return value of wantarray?
by Alien
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |