From 9a269cdf6e214d9eb2d08c2068c0b179a91f24ee Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Wed, 30 Sep 2020 16:27:22 -0700 Subject: [PATCH] added example to docs --- bin/perltidy | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bin/perltidy b/bin/perltidy index b1b7d890..45926b67 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -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 -- 2.39.5