- or download this
my @nums = ('1203', '1204', '1207');
my $regex = '\b(?:' + join('|', @nums) + ')\b';
- or download this
c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le
"my @nums = ('1203', '1204', '1207');
...
"
'\b(?:1203|1204|1207)\b'
[1207, 1203]
- or download this
while ( <$file_h> ) {
if (my @matches = m/$regex/g) {
...
print "$file $_";
}
}
- or download this
c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le
"my @nums = qw(1203 1204 1207 1111);
...
{ 1203 => 2, 1207 => 3 }
num(s) not seen: 1204 1111