But I still would argue that ,, being interpreted as ,(), should be documented.
Actually, those are not the same either.
$a = (4, 3, ,); # sets $a to 3
$b = (4, 3, (),); # sets $b to undef
Please stop treating a trailing comma or two consecutive commas as anything
other than "this disappears like you never even wrote it". It's like making something
out of how many newlines you put after a statement.
It has no semantics. Get it?
-- Randal L. Schwartz, Perl hacker | [reply] [d/l] |
It has no semantics. Get it?
Got it! :-)
It's like making something out of how many newlines you put after a statement
And I suppose this highlights the conceptual block here. Its easy to see/understand that a bunch of whitespace has no semantic meaning. Its a lot harder to see that a bunch of comas in the middle of something has no meaning... Hence the reason I'd like to see this documented at least.
Yves / DeMerphq
--
When to use Prototypes?
| [reply] |
$a = (4, 3, ,); # sets $a to 3
$b = (4, 3, (),); # sets $b to undef
Agreed, but that's a different issue. Here it is in scalar context. demerphq was using [], not ().
In list context () does indeed interpolate as "nothing". | [reply] [d/l] [select] |