cpomp,
First, there is more than a nominal amount of time spent calling check_bypass() millions of times so it would be best to inline that code. It would be better if your skip file contained exact matches instead of regular expressions because then you could just say
next if $skip{$_}; Instead, I would suggest the following (untested):
#!/usr/bin/perl
use strict;
use warnings;
use Regexp::Assemble;
my $skip_file = $ARGV[0] or die "Usage: $0 <skip_file>;
my $ra = Regexp::Assemble->new();
$ra->add_file($skip_file);
my $skip = $ra->re;
open(my $fh, '<', 'log.txt') or die "Unable to open 'log.txt' for rea
+ding: $!";
while (<$fh>) {
next if /$skip/;
print;
}
Minor addition: Depending on the contents of your skip file, there are other modules that may be a better choice but only you would know that unless you share examples.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.