The PBP suggests breaking assignments much like it suggests breaking other operators; the assignment leads the broken line:
my $thingy = $stuff + $hard_things + $foo;
This is good for all the reasons they described in breaking other operators that way. I admit, I rarely do it; I tend to put more on the line, and break before one of the operators.
my $thingy = $stuff + $hard_things + $foo;
I think it’s a good idea, I just don’t break that early very often. The book’s suggestion that it would allow you to keep the whole assignment together is interesting, and I’m not against it, but I never think to do it. I’m busy writing stuff, not formatting it for later.
Tags: perl programming