]> git.donarmstrong.com Git - perltidy.git/commitdiff
added example to docs
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 30 Sep 2020 23:27:22 +0000 (16:27 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 30 Sep 2020 23:27:22 +0000 (16:27 -0700)
bin/perltidy

index b1b7d89079525d780c203b27fe0574fd32f9941b..45926b67aed2e35da4c4a694775c5c4b771f45d1 100755 (executable)
@@ -1179,6 +1179,20 @@ But the following will give a syntax error:
   # perltidy -nwrs='-'
   my @newkeys = map $_ -$nrecs + @data, @oldkeys;
 
+For another example, the following two lines will be parsed without syntax error:
+
+  # original programming, syntax ok
+  for my $severity ( reverse $SEVERITY_LOWEST+1 .. $SEVERITY_HIGHEST ) { ...  }
+
+  # perltidy default, syntax ok
+  for my $severity ( reverse $SEVERITY_LOWEST + 1 .. $SEVERITY_HIGHEST ) { ... }
+
+But the following will give a syntax error:
+
+  # perltidy -nwrs='+', syntax error:
+  for my $severity ( reverse $SEVERITY_LOWEST +1 .. $SEVERITY_HIGHEST ) { ... }
+
+As a general rule, it seems best to keep whitespace balanced around binary operators.
 
 =item Space between specific keywords and opening paren