in reply to Re: (tye)Re: Bug with lists?
in thread Bug with lists?

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

Replies are listed 'Best First'.
Re: Re: Re: (tye)Re: Bug with lists?
by demerphq (Chancellor) on Feb 18, 2002 at 14:59 UTC
    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?

Re: Re: Re: (tye)Re: Bug with lists?
by Anonymous Monk on Feb 21, 2002 at 01:05 UTC
    $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".