Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Bolt on where a match is not found to a print script

by AnomalousMonk (Archbishop)
on Dec 05, 2017 at 14:01 UTC ( [id://1204964]=note: print w/replies, xml ) Need Help??

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
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1204964]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-18 22:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found