Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Improving if statements

by Bloodnok (Vicar)
on Sep 19, 2014 at 08:13 UTC ( #1101167=note: print w/replies, xml ) Need Help??


in reply to Improving if statements

TIMTOWTDI, if order matters, as it tends to in a test (.t file), I frequently use something along the lines of ...
# Defaine default my $change = "neutral"; my @lookup = ( { test => "blue" }, { dark => "black" }, { white => "light" }, { house => "home" }, { all\ things => "multi" }, { money => "value" }, { country => "USA" }, ); while (my ($i, $c) = each %lookup) { next unless $item eq $i; $change = $c; last; }
A purely untested suggestion ...

A user level that continues to overstate my experience :-))

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2020-10-26 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (252 votes). Check out past polls.

    Notices?