Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^2: The three features of undef (renamed)by LanX (Saint) |
on Aug 16, 2020 at 16:19 UTC ( [id://11120818]=note: print w/replies, xml ) | Need Help?? |
> I think of this as an idiomatic use which means exactly what you describe It's a documented behavior of list assignments. See perldata#List-value-constructors
Lists may be assigned to only when each element of the list is itself legal to assign to:
updateFor the rest: Perl has the symbol undef acting like a constant for the "undefined value" and a builtin function undef(EXPR) to "undefine one variable" which also returns undef to the LHS. It might be confusing that they are equally named, but I rarely use the function anyway.
PS:since constants are just special functions in Perl, it could be that undef and undef(EXPR) are implemented in one (magic) operator which does constant folding when called without arguments. But that's an implementation detail, located somewhere between parser and op-tree.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|