Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
"be consistent"
 
PerlMonks  

Re: Range Operator in If Statement

by Perlbotics (Abbot)
on Jan 04, 2012 at 20:45 UTC ( #946288=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      if ( grep { $ref == $_ } 1..8 )  { ... }
    
  2. or download this
      if ( $ref >= 1  and  $ref <= 8 )  { ... }
    
  3. or download this
      if ( $ref =~ /^[1-8]$/ )  { ... }
    
  4. or download this
    use v5.10;
    use strict;
    ...
        default               { say "ELSE $ref" }
      }
    }
    
  5. or download this
    A 1
    B 9
    C 17
    D 25
    ELSE 33
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-04-23 23:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (557 votes), past polls