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

Fair point. But I still would argue that ,, being interpreted as ,(), should be documented.

Yves / DeMerphq
--
When to use Prototypes?

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

      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?

      $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".