Comma operator

In a list context, , is the list argument separator and inserts both its arguments into the list. In scalar context, , evaluates its left argument, throws that value away, then evaluates its right argument and returns that value.

The => operator is mostly just a synonym for the comma operator. It’s useful for documenting arguments that come in pairs. It also forces any identifier to the left of it to be interpreted as a string.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.