6

By default, PerlTidy will line up assignments in my code. E.g.

PerlTidy changes this...

my $red = 1;
my $green = 2;
my $yellow = 3;
my $cyan = 4;

...into this...

my $red    = 1;
my $green  = 2;
my $yellow = 3;
my $cyan   = 4;

How do I prevent this from happening? I've trawled the manual but I can't find a solution.

Thanks!

nick
  • 1,369
  • 2
  • 13
  • 28
  • See also [How can I prevent PerlTidy from aligning assignments but keep adding single spaces?](http://stackoverflow.com/questions/4538209/how-can-i-prevent-perltidy-from-aligning-assignments-but-keep-adding-single-spac) – Sjoerd Aug 08 '14 at 13:15

1 Answers1

9

See the discussion of the -aws option (--add-whitespace). By default -aws is enabled. You can alter this behavior using -naws (deleting whitespace is OK, but don't add) or -fws (don't add or delete whitespace). Details here.

FMc
  • 41,963
  • 13
  • 79
  • 132
  • Thanks FM. -naws does roughly what I want. It won't un-align assignments that are already aligned, but such is life :) – nick Jun 18 '10 at 08:36
  • Is it possible to keep addition of single spaces? I have just asked such a question here: http://stackoverflow.com/questions/4538209/how-can-i-prevent-perltidy-from-aligning-assignments-but-keep-adding-single-space – agsamek Dec 27 '10 at 11:00