Perhaps you could read all of the lines from your second file, before starting to process the first, and construct a single regular expression with all of the strings you want to exclude.

johngg@shiraz:~/perl/utils$ perl -Mstrict -Mwarnings -E ' open my $file2FH, q{<}, \ <<__EOD2__ or die $!; /dumpx/DUMP4X/var/level6/55 /dumpx/DUMP4X/var/level7/58 __EOD2__ my $rxExcl = do { chomp( my @lines = <$file2FH> ); local $" = q{|}; qr{@lines}; }; close $file2FH or die $!; open my $file1FH, q{<}, \ <<__EOD1__ or die $!; /dev/sda3 6 Fri Apr 12 04:27:19 2019 +0100 /dumpx/DUMP3X/var/level6/ +47 81.34 MB /dev/sda4 6 Fri Apr 12 04:30:02 2019 +0100 /dumpx/DUMP4X/var/level6/ +55 86.53 MB /dev/sdb1 6 Fri Apr 12 04:31:47 2019 +0100 /dumpx/DUMP4X/var/level6/ +56 27.73 MB /dev/sdb2 6 Fri Apr 12 04:33:33 2019 +0100 /dumpx/DUMP4X/var/level7/ +58 57.32 MB __EOD1__ while ( <$file1FH> ) { print unless m{$rxExcl}; } close $file1FH or die $!;' /dev/sda3 6 Fri Apr 12 04:27:19 2019 +0100 /dumpx/DUMP3X/var/level6/ +47 81.34 MB /dev/sdb1 6 Fri Apr 12 04:31:47 2019 +0100 /dumpx/DUMP4X/var/level6/ +56 27.73 MB

I hope this is useful.

Cheers,

JohnGG


In reply to Re: Regex variables with delimiters by johngg
in thread Regex variables with delimiters by clerew

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.