Most likely it is that you need to quote the BadShares interpolated string: m/(\Q$BadShares[$i]\E)/i. However, the code snippet you have given is not ameniable to us reproducing your error. Try plugging suitable data into:

use strict; use warnings; open tempFile, '>', "test.dat"; print tempFile <<TEMP; it is always the last line). Line 23 is the pattern match part of the +code. If is my early test script before I get it to go through a list of files +in a TEMP close tempFile; my @BadShares = <DATA>; # Open the file/s to remove these matches from open CURRENTDAT, '<', "test.dat"; my @DatLines = <CURRENTDAT>; # For each line in the file to match from for ($a = 0; $a < scalar(@DatLines); $a++) { # Go through each line of the file to remove these matches from for (my $i = 0; $i < scalar(@BadShares); $i++) { # If the current line in the DAT matches any line in the file +to match set # that line to zero if ($DatLines[$a] =~ m/(\Q$BadShares[$i]\E)/i) { print "MATCH $DatLines[$a] $BadShares[$i]"; } } } __DATA__ Line 8 is the last line in the file test.dat (this error changes if I +add lines it is always the last line). Line 23 is the pattern match part of the +code. If I print the lines as it goes it is less than half way through Bad_Shar +es.TXT and the line changes as I add lines to test.dat (running out of memory +?). This is my early test script before I get it to go through a list of files +in a given directory (lots of DATs containing drives to map for specific us +ers).

Prints:

MATCH it is always the last line). Line 23 is the pattern match part +of the code. If it is always the last line). Line 23 is the pattern match part +of the code. If MATCH is my early test script before I get it to go through a list of + files in a is my early test script before I get it to go through a list of + files in a

DWIM is Perl's answer to Gödel

In reply to Re: Remove lines from a list of files based on those in a given file by GrandFather
in thread Remove lines from a list of files based on those in a given file by Paws_of_Iron

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.