Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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, $/;
"My two cents aren't worth a dime.";

Comment on Re: Perl Number range lookup question
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2015-08-28 20:21 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (340 votes), past polls