in reply to matching numeric range

i give it a try
use strict; my @check = ('A4:123:C'); my @ranges = ('A0-7:123:C', 'B8-15:456:D', 'A5-7:123:C'); foreach my $check (@check) { my @cp = $check =~ m!(\w)(\d+):(\d+):(\w)!; foreach my $range (@ranges) { if($range =~ m!$cp[0](\d+)\-(\d+):$cp[2]:$cp[3]!) { if($check[0] >= $1 and $check[0] <= $2) { print "$check mathes $range\n"; } } } }
HTH

Replies are listed 'Best First'.
Re^2: matching numeric range
by state-o-dis-array (Hermit) on Feb 24, 2005 at 22:42 UTC
    This is probably closer to what I am looking for, thanks esskar, I have to play with the my @cp = $check =~ m!(\w)(\d+):(\d+):(\w)!; line, I've never done something like that.