Help for this page

Select Code to Download


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