7 $lookup = { a => 1, b => 2 };
9 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
19 ## name List including assignments
23 @w = ($x = 1, $y = 2, $z = 3);
25 #-----------------------------------------------------------------------------
27 ## name List containing statement
33 #-----------------------------------------------------------------------------
35 ## name List containing statement in a constructor that is reported as a block
45 #-----------------------------------------------------------------------------
47 ## name Regular statement inside a block.
51 foreach my $path ( @ARGV ) {
52 utter 'Looking at ', $path, '.';
55 #-----------------------------------------------------------------------------
57 ## name Sub call after comma
63 #-----------------------------------------------------------------------------
65 ## name Regular sub call before comma
69 # The space between the sub name and the left parenthesis is significant
70 # in that part of Conway's point is that things that look like lists may
75 #-----------------------------------------------------------------------------
77 ## name No-argument sub call via use of sigil
81 @x = &foo, @y, bar @z;
83 #-----------------------------------------------------------------------------
91 #-----------------------------------------------------------------------------
93 ## name Built-in call that provides a list context without parentheses
99 #-----------------------------------------------------------------------------
101 ## name Built-in call that provides a list context, called like a function
107 #-----------------------------------------------------------------------------
109 ## name Built-in call that takes multiple arguments without parentheses
113 @x = substr $y, 1, 2;
115 #-----------------------------------------------------------------------------
117 ## name Built-in call that takes multiple arguments, called like a function
121 @x = substr ($y, 1), 2;
123 #-----------------------------------------------------------------------------
125 ## name Call to unary built-in without parentheses
131 #-----------------------------------------------------------------------------
133 ## name Unary built-in, called like a function
139 #-----------------------------------------------------------------------------
141 ## name Call to no-argument built-in without parentheses
147 #-----------------------------------------------------------------------------
149 ## name No-argument built-in, called like a function
155 #-----------------------------------------------------------------------------
157 ## name Call to optional argument built-in without an argument without parentheses
163 #-----------------------------------------------------------------------------
165 ## name Optional argument built-in, called like a function without an argument
171 #-----------------------------------------------------------------------------
173 ## name Call to optional argument built-in with an argument without parentheses
179 #-----------------------------------------------------------------------------
181 ## name Optional argument built-in, called like a function with an argument
187 #-----------------------------------------------------------------------------
193 for ($x = 0, $y = 0; $x < 10; $x++, $y += 2) {
197 #-----------------------------------------------------------------------------
203 for ($x, 'x', @y, 1, ) {
207 #-----------------------------------------------------------------------------
213 @list = qw<1, 2, 3>; # this really means @list = ('1,', '2,', '3');
215 #-----------------------------------------------------------------------------
217 ## name original RT #27654
222 @arr1 = split /b/, 'abc';
224 #-----------------------------------------------------------------------------
226 ## name RT #27654 - NKH example 1
228 ## TODO PPI parses this code as a block and not a hash constructor.
233 "string" => $aliased_history,
234 TIME => $self->{something},
237 #-----------------------------------------------------------------------------
239 ## name RT #27654 - NKH example 2 - without allow_last_statement_to_be_comma_separated_in_map_and_grep
243 %hash = map {$_, 1} @list ;
245 #-----------------------------------------------------------------------------
247 ## name RT #27654 - NKH example 2 - with allow_last_statement_to_be_comma_separated_in_map_and_grep
249 ## parms { allow_last_statement_to_be_comma_separated_in_map_and_grep => 1 }
252 %hash = map {$_, 1} @list ;
254 #-----------------------------------------------------------------------------
256 ## name RT #27654 - NKH example 3
258 ## TODO PPI parses this code as blocks and not hash constructors.
263 { %{$a_hash_ref}, %{$another_hash_ref}},
267 #-----------------------------------------------------------------------------
269 ##############################################################################
270 # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.run $
271 # $Date: 2008-03-16 17:40:45 -0500 (Sun, 16 Mar 2008) $
272 # $Author: clonezone $
274 ##############################################################################
278 # cperl-indent-level: 4
280 # indent-tabs-mode: nil
281 # c-indentation-style: bsd
283 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :