# ... my $rw = $mw->Label(-textvariable => \$rightwrong, -foreground => $colour)->pack(-side=> 'bottom'); # ... if ($answer == $guess) { #count correct answers $correct++; $rightwrong = 'Correct!'; $rw->configure(-foreground => 'green'); }else{ $rightwrong = 'Wrong!'; $rw->configure(-foreground => 'red'); } # ...