Документация
HTML CSS PHP PERL другое

Section 5.11.  Slice Layout

 
Previous
Table of Contents
Next

5.11. Slice Layout

Use a tabular layout for slices.

A slice-to-slice assignment like:


    @frames[-1,-2,-3]
        = @active{'top', 'prev', 'backup'};

can also be written as:


      @frames[ -1,    -2,     -3     ]
    = @active{'top', 'prev', 'backup'};

This second version makes it immediately apparent which hash entry is being assigned to which array element. Unfortunately, this approach is useful only when the number of keys/indices in the slices is small. As soon as either list exceeds a single line, the readability of the resulting code is made much worse by vertical alignments:

      @frames[ -1,    -2,     -3,      -4,          -5,      -6,
               -7,          -8     ]
    = @active{'top', 'prev', 'backup', 'emergency', 'spare', 'rainy day',
              'alternate', 'default'};

    Previous
    Table of Contents
    Next
    © 2000- NIV