my %bkcolor = ( "Extreme", "red", "Severe", "orange", "Moderate", "yellow", "Minor", "green", "", "grey" ); my $background = $bkcolor{$severity};