Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Replacing If Elsif Else with Hash

by frozenwithjoy (Curate)
on Nov 24, 2012 at 05:07 UTC ( #1005332=note: print w/ replies, xml ) Need Help??


in reply to Replacing If Elsif Else with Hash

This will return 'grey' if you use a severity not defined in the hash:

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


Comment on Re: Replacing If Elsif Else with Hash
Download Code
Re^2: Replacing If Elsif Else with Hash
by johnfl68 (Beadle) on Nov 24, 2012 at 05:29 UTC

    Thank you very much for you time and help!

    John

Re^2: Replacing If Elsif Else with Hash
by moritz (Cardinal) on Nov 24, 2012 at 08:59 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005332]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2015-07-06 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (72 votes), past polls