Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my @short_org_name = keys %myorgs; my $count=2; my $frame; foreach (@short_org_name) { my $score = $hits{$myorgs{$title_order{$count}}}; if ($score eq "NoHit") { $frame = $tab->Label(-bg => 'black', -relief => 'sunken' +, width => 15); $balloon->attach($frame,-balloonmsg => "No Hits"); } else { if ($score == 0) { $frame = $tab->Label(-bg => 'red', -relief => 'sunken +', width => 15); $balloon->attach($frame,-balloonmsg => "E = 0"); } if (1e-99 <= $score && $score < 1e-90) { $frame = $tab->Label(-bg => 'orange', -relief => 'sun +ken', width => 15); $balloon->attach($frame,-balloonmsg => "1e-99 < E < 1 +e-90"); } if (1e-90 <= $score && $score < 1e-80) { $frame = $tab->Label(-bg => 'gold', -relief => 'sunke +n', width => 15); $balloon->attach($frame,-balloonmsg => "1e-90 < E < 1 +e-80"); } if (1e-80 <= $score && $score < 1e-70) { $frame = $tab->Label(-bg => 'yellow', -relief => 'sun +ken', width => 15); $balloon->attach($frame,-balloonmsg => "1e-80 < E < 1 +e-70"); } if (1e-70 <= $score && $score < 1e-60) { $frame = $tab->Label(-bg => 'chartreuse', -relief => +'sunken', width => 15); $balloon->attach($frame,-balloonmsg => "1e-70 < E < 1 +e-60"); } if (1e-60 <= $score && $score < 1e-50) { $frame = $tab->Label(-bg => 'green', -relief => 'sunk +en', width => 15); $balloon->attach($frame,-balloonmsg => "1e-60 < E < 1 +e-50"); } if (1e-50 <= $score && $score < 1e-40) { $frame = $tab->Label(-bg => 'turquoise', -relief => ' +sunken', width => 15); $balloon->attach($frame,-balloonmsg => "1e-50 < E < 1 +e-40"); } if (1e-40 <= $score && $score < 1e-30) { $frame = $tab->Label(-bg => 'blue', -relief => 'sunke +n', width => 15); $balloon->attach($frame,-balloonmsg => "1e-40 < E < 1 +e-30"); } if (1e-30 <= $score && $score < 1e-20) { $frame = $tab->Label(-bg => 'pink', -relief => 'sunke +n', width => 15); $balloon->attach($frame,-balloonmsg => "1e-30 < E < 1 +e-20"); } if (1e-20 <= $score && $score < 1e-10) { $frame = $tab->Label(-bg => 'purple', -relief => 'sun +ken', width => 15); $balloon->attach($frame,-balloonmsg => "1e-20 < E < 1 +e-10"); } if (1e-10 <= $score && $score < 1) { $frame = $tab->Label(-bg => 'grey', -relief => 'sunke +n', width => 15); $balloon->attach($frame,-balloonmsg => "1e-10 < E < 1 +"); } }
20030817 Edit by Corion: Fixed formatting
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: doing the same thing but with less code
by blokhead (Monsignor) on Aug 16, 2003 at 22:57 UTC | |
by Anonymous Monk on Aug 17, 2003 at 23:22 UTC | |
|
Re: doing the same thing but with less code
by larsen (Parson) on Aug 16, 2003 at 22:39 UTC | |
|
Re: doing the same thing but with less code
by antirice (Priest) on Aug 16, 2003 at 22:39 UTC | |
|
Re: doing the same thing but with less code
by bart (Canon) on Aug 17, 2003 at 20:07 UTC |