http://www.perlmonks.org?node_id=946297


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 ] ) { ... }