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

Re: Range Operator in If Statement

by TJPride (Pilgrim)
on Jan 05, 2012 at 05:29 UTC ( #946325=note: print w/replies, xml ) Need Help??


in reply to Range Operator in If Statement

If the ranges you're matching on are consecutive, you could do something like this:

use strict; use warnings; for (-4, 1, 7, 12, 89, 54, 13, 104) { if ($_ < 1 || $_ > 64) { print "$_ outside.\n" } elsif ($_ <= 8) { print "$_ 1-8\n"; } elsif ($_ <= 16) { print "$_ 9-16\n"; } elsif ($_ <= 32) { print "$_ 17-32\n"; } elsif ($_ <= 64) { print "$_ 33-64\n"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://946325]
help
Chatterbox?
[Lady_Aleena]: Well, right now, I"m looking at modules where I put randomness that aren't in my RolePlaying/Random dir, like RolePlaying:: Character:: Alignment that is mostly about random_alignment than expand_alignment.
[erix]: cute
[Lady_Aleena]: So, I'm thinking about splitting it between the two different things.
[Discipulus]: erix resize your elephant

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-05-27 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?