Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Perl Number range lookup question

by sauoq (Abbot)
on Jun 18, 2012 at 01:23 UTC ( [id://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.";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-29 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found