Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I was trying to put all of the colors, and all of the value strings in 1 or 2 arrays and add a for loop but couldn't seem to get it to work. Any help from people more experienced than I am would be greatly appreciated.my ($frame,$value); foreach (@values) { my $boo = $hits{$myorgs{$title_order{$count}}}; if ($boo eq "Self") { $frame = $tab->Label(-bg => 'black', -relief => 'sunken +', width => 10); } else { if ($boo == 0) { $frame = $tab->Label(-bg => 'red', -relief => 'sunke +n', width => 10); $balloon->attach($frame,-balloonmsg => "E = 0"); } if (1e-99 <= $boo && $boo < 1e-90) { $frame = $tab->Label(-bg => 'orange', -relief => 'su +nken', width => 10); $balloon->attach($frame,-balloonmsg => "1e-99 < E < +1e-90"); } if (1e-90 <= $boo && $boo < 1e-80) { $frame = $tab->Label(-bg => 'gold', -relief => 'sunk +en', width => 10); $balloon->attach($frame,-balloonmsg => "1e-90 < E < +1e-80"); } if (1e-80 <= $boo && $boo < 1e-70) { $frame = $tab->Label(-bg => 'yellow', -relief => 'su +nken', width => 10); $balloon->attach($frame,-balloonmsg <br>=> "1e-80 < +E < 1e-70"); } if (1e-70 <= $boo && $boo < 1e-60) { $frame = $tab->Label(-bg => 'chartreuse', -relief => + 'sunken', width => 10); $balloon->attach($frame,-balloonmsg => "1e-70 < E < +1e-60"); } if (1e-60 <= $boo && $boo < 1e-50) { $frame = $tab->Label(-bg => 'green', -relief => 'sun +ken', width => 10); $balloon->attach($frame,-balloonmsg => "1e-60 < E < +1e-50");<br> } if (1e-50 <= $boo && $boo < 1e-40) { $frame = $tab->Label(-bg => 'turquoise', -relief => +'sunken', width => 10); $balloon->attach($frame,-balloonmsg => "1e-50 < E < +1e-40"); } if (1e-40 <= $boo && $boo < 1e-30) { $frame = $tab->Label(-bg => 'navy blue', -relief => +'sunken', width => 10); $balloon->attach($frame,-balloonmsg => "1e-40 < E < +1e-30"); } if (1e-30 <= $boo && $boo < 1e-20) { $frame = $tab->Label(-bg => 'lavender', -relief => ' +sunken', width => 10); $balloon->attach($frame,-balloonmsg <br>=> "1e-30 < +E < 1e-20"); } if (1e-20 <= $boo && $boo < 1e-10) { $frame = $tab->Label(-bg => 'purple', -relief => 'su +nken', width => 10); $balloon->attach($frame,-balloonmsg => "1e-20 < E < +1e-10"); } if (1e-10 <= $boo && $boo < 1) { $frame = $tab->Label(-bg => 'grey', -relief => 'sunk +en', width => 10); $balloon->attach($frame,-balloonmsg => "1e-10 < E < +1"); } }
Thanks,
Mark
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: slow code help
by japhy (Canon) on Aug 08, 2003 at 00:10 UTC | |
|
Re: slow code help
by revdiablo (Prior) on Aug 08, 2003 at 00:06 UTC | |
|
Re: slow code help
by Zaxo (Archbishop) on Aug 08, 2003 at 01:08 UTC |