Next Program Repair Shop 144

Repeated Data Structure

    75     $rounds = {
    76                round1 => {
    77                           player => $page->param('round1_x'),
    78                           computer => $page->param('round1_o')
    79                          },
    80                round2 => {
    81                           player => $page->param('round2_x'),
    82                           computer => $page->param('round2_o')
    83                          },
           ...

Do Not Repeat Code

        for my $rn (1..5) {
          $rounds->{"round$rn"} = 
            { player   => $page->param("round${rn}_x"),
              computer => $page->param("round${rn}_o"),
            } 
       }


Next Copyright © 2002 M. J. Dominus