for (0..$numChem){ ${$wtPercent}[$_] = 0; $wtpercentcolor{$_} = "white"; #initialized hash to originally set all colors to white }; for (0..$numChem){${$vol}[$_] = 0}; for (0..$numChem) { $wtPercentbox[$_] = $frame10->Entry( -textvariable => \${$wtPercent}[$_], -width => 5, -background => $wtpercentcolor{$_} #set background color ); $wtPercentbox[$_] -> pack(-pady => 4); }