Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Perl's comma operator , performs several duties. The most widely known duty is to serve as a list separator. List separators are called fat commas [Conway 052005].

Code Block
my @list = (2, 3, 5, 7);

Outside of list context, the comma can also be used to combine multiple expressions into one statement. Each expression is evaluated, and its result is discarded. The last expression's result is returned as the result of the comma operator. Comma operators are called thin commas [Conway 052005]. This behavior was adopted from C.

...