Perl's comma operator {{ Wiki Markup ,
}} performs several duties. The most widely-known duty is to serve as a list separator. These are referred to as "fat commas" \[ [Conway 05|AA. Bibliography#Conway 05]\].
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. These are referred to as "thin commas" \ [[Conway 05|AA. Bibliography#Conway 05]\]. This behavior was adopted from C. Wiki Markup
The potential for confusing thin commas with fat commas is large enough to forbid use of the thin commas. Commas shall only be used to separate items in list context.
...
Tool | Diagnostic |
---|---|
Perl::Critic | ValuesAndExpressions::ProhibitCommaSeparatedStatements |
Bibliography
...
\[[Conway 05|AA. Bibliography#Conway 05]\] pg. 68 "Thin Commas"
\
[[CPAN|AA. Bibliography#CPAN] \] [Elliot Shank, Perl-Critic-1.116|http://search.cpan.org/~elliotjs/ Perl-Critic-1.116/] [ValuesAndExpressions::ProhibitCommaSeparatedStatements|http://search.cpan.org/dist/Perl-Critic/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitCommaSeparatedStatements.pm]
...
01. Declarations and Initialization DCL32-PL. Every module must return a true value