in reply to Re^2: wantarray documentation in 5.8.7
in thread wantarray documentation in 5.8.7
So, the wantarray is used "at the top of the file", but it seems that wantarray is working fine. Can we rely on it?
No, we can't. That's exactly what the docs are saying, unequivocally. They say that this behavior is unspecified, i.e. "don't rely on it". The fact that it appears to work in your example does not in any way contradict this.
Let me give you another example, one that came up in a recent thread. The docs for undef clearly state (my emphasis)
undef EXPRNow, if I try this on v5.8.6:
undef
Undefines the value of EXPR, which must be an lvalue. Use only on a scalar value, an array (using @), a hash (using %), a subroutine (using &), or a typeglob (using *).
it appears to work (i.e. $h{ 1 } and $h{ 2 } get set to undef). Still this code is using unspecified/undocumented behavior, because it is applying undef to a list, which is none of the documented valid arguments for undef. Hence, according to the docs, such code is liable to break in the future, and it would be considered a bad practice to use such code, that it appears to work notwithstanding.undef @h{ 1, 2 };
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: wantarray documentation in 5.8.7
by polettix (Vicar) on Jul 25, 2005 at 16:42 UTC | |
by Anonymous Monk on Jul 26, 2005 at 00:39 UTC |