2.3. Subroutines and Variables
Don't separate subroutine or variable names from the following opening bracket .
In order for the previous rule to work properly, it's important that subroutines and variables not have a space between their names and any following brackets. Otherwise, it's too easy to mistake a subroutine call for a control structure, or misread the initial part of an array element as an independent scalar variable.So cuddle subroutine calls and variable names against their trailing parentheses or braces:
my @candidates = get_candidates($marker);
CANDIDATE:
for my $i (0..$#candidates) {
next CANDIDATE if open_region($i);
$candidates[$i]
= $incumbent{ $candidates[$i]{region} };
}
Spacing them out only makes them harder to recognize:
my @candidates = get_candidates ($marker);
CANDIDATE:
for my $i (0..$#candidates) {
next CANDIDATE if open_region ($i);
$candidates [$i]
= $incumbent {$candidates [$i] {region}};
}