Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 romping around the Monastery: (7)
As of 2014-12-27 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls