Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
P is for Practical
 
PerlMonks  

Re: Range Operator in If Statement

by kejohm (Hermit)
on Jan 04, 2012 at 21:35 UTC ( #946297=note: print w/ replies, xml ) Need Help??


in reply to Range Operator in If Statement

If you are able to upgrade to a newer version of Perl, starting with v5.10, you can use the smart match operator, eg:

use 5.010; my $ref = 7; if ( $ref ~~ [ 1 .. 8 ] ) { ... }


Comment on Re: Range Operator in If Statement
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2014-04-20 00:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls