Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Perl Number range lookup question

by sauoq (Abbot)
on Jun 18, 2012 at 01:23 UTC ( #976713=note: print w/ replies, xml ) Need Help??


in reply to Perl Number range lookup question

#!/usr/bin/perl my $x = 40; my $tier; sub get_tier { my $x = shift; my $t = 0; $t += ($x > $_) for (@_); return $t; } $tier = get_tier($x, 9,19,29,39) if ($x >= 0 and $x < 50); $tier = get_tier($x, 59,69,79,89) if ($x >= 50 and $x < 100); print $tier, $/;
-sauoq
"My two cents aren't worth a dime.";


Comment on Re: Perl Number range lookup question
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2014-07-28 23:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (210 votes), past polls