On Thu, 1 Jul 2004 16:14:37 -0700 (PDT), Jonathan Lang <[EMAIL PROTECTED]> wrote:

Actually, the whole purpose of the C-style comma is to allow you to place
multiple expressions in a place that's only designed to take one, such as
the various divisions within a loop control set ("loop ($i = 0, $j = 1; $i
< 10; $i++, $j*=2) {...}"). For something like this, you might be better
off doing something like


  last($a, $b, $c)

instead of

$a then $b then $c
(where last is a sub that takes a list of arguments, evaluates them one at
a time, and returns the value of the last one).

I remember perl5 scalar: scalar($a, $b, $c)

f.e.:

  sub test {print wantarray ? "list\n"
                : defined wantarray  ? "scalar\n" : "void\n"}

  scalar (test,test,test)

prints

  void
  void
  scalar

...
hm.. sorry, scalar() isn't needed at all:)

  2+(test,test,test)

gives the same.. it's a perl5 comma's behavior, not perl5 scalar()

...
ok, all I want is an ability to write operator which wouldn't try to create lists or store result of first operand and will call it in _void_ context, so I could easily write short postfix loops and conditionals when I want to.

Reply via email to