Приглашаем посетить
Татищев (tatischev.lit-info.ru)

Section B.5.  Chapter 6, Control Structures

Previous
Table of Contents
Next

B.5. Chapter 6, Control Structures

  • Use block if, not postfix if. [If Blocks]

  • Reserve postfix if for flow-of-control statements. [Postfix Selectors]

  • Don't use postfix unless, for, while, or until. [Other Postfix Modifiers]

  • Don't use unless or until at all. [Negative Control Statements]

  • Avoid C-style for statements. [C-Style Loops]

  • Avoid subscripting arrays or hashes within loops. [Unnecessary Subscripting]

  • Never subscript more than once in a loop. [Necessary Subscripting]

  • Use named lexicals as explicit for loop iterators. [Iterator Variables]

  • Always declare a for loop iterator variable with my. [Non-Lexical Loop Iterators]

  • Use map instead of for when generating new lists from old. [List Generation]

  • Use grep and first instead of for when searching for values in a list. [List Selections]

  • Use for instead of map when transforming a list in place. [List Transformation]

  • Use a subroutine call to factor out complex list transformations. [Complex Mappings]

  • Never modify $_ in a list function. [List Processing Side Effects]

  • Avoid cascading an if. [Multipart Selections]

  • Use table look-up in preference to cascaded equality tests. [Value Switches]

  • When producing a value, use tabular ternaries. [Tabular Ternaries]

  • Don't use do...while loops. [do-while Loops]

  • Reject as many iterations as possible, as early as possible. [Linear Coding]

  • Don't contort loop structures just to consolidate control. [Distributed Control]

  • Use for and redo instead of an irregularly counted while. [Redoing]

  • Label every loop that is exited explicitly, and use the label with every next, last, or redo. [Loop Labels]

    Previous
    Table of Contents
    Next