The sixth chapter: Control structure 0 LU Ii.
Use the code block if, and do not use the suffix if.
For example, the following is not a good idea:
$sum + = $measurement if defined $measurement;
In fact, it equals:
if (defined $measurement) {
$sum + = $measurement;
} 0 on three continents.
The suffix if is to be persisted to the process Control statement. 0 Land establishments.
do not use unless, for, while, and until as suffixes. 0 Lu Wu.
Never use unless or until. 0 Land and land.
avoid C-style for statements. 0 Land Seven.
avoid indexing arrays or hashes within a loop. 0 Land Ba.
never mark an index more than once in a loop. 0 Lu Ying.
use a noun-method variable as a for loop iterator. 0 Qi 0.
always declare a for loop iterator with my. 0 Qi One.
to create a new list from the old list, use map instead of for. 0 Qi Ii.
to find the values in the list, use grep and first, not for. 0 Qi Three.
to convert the list, use for, not map. 0 Qi Restaurant.
use subroutine calls to separate complex list conversions. 0 Qi Wu.
never modify $_ in a list function. 0 Qi Lu.
avoid cascading if. 0 Qi Qi.
the use of table lookups is preferred when cascading equality tests. 0 qi Ba.
A ternary expression that uses a tabular format when a value is generated. 0 Qi Jiu.
do not use do...while loops. 0 BA 0.
reject loop iterations as much as possible and as early as you can. 0 ba.
do not distort the loop structure for the sake of concentration control. 0 ba.
use for and redo, do not use the irregular count while. 0 ba three.
label Each loop that will explicitly leave,
The label is then used for each next, last, and redo.
Perl Best Practices (excerpt)---06