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


in reply to Range Operator in If Statement

Another way, perhaps even related to the code in OP:
#!/usr/bin/perl use Modern::Perl; # 946284 my $ref = 7; for (1 .. 8 ) { if ($ref == $_) { say "\$ref: $ref"; # adjust output to id source of match? } else { say "Tain't workin'"; } }

Seems to me this might be readily expansible to your larger goal as outlined in Re^2: Range Operator in If Statement