in reply to Re: Matching and removing a line from a file
in thread Matching and removing a line from a file

/^\Q$entry\E\z/
If the entry field for which a record is to be excluded is anchored to the start and end of the string against which it is matching (so that the match is the same as testing for string equality), doesn't that mean that no record will ever match (and so no record will ever be excluded) because no exclusion field will ever match the entire record?

Also, because the exclusion fields are never paired to any specific fields of the record in the code of the OP, if one was seeking to exclude Jim Jones of Dade county, would not Jim Dade of Jones county (or, indeed, any record having 'Jim', 'Dade' or 'Jones' in any field) also be excluded?

Replies are listed 'Best First'.
Re^3: Matching and removing a line from a file
by ikegami (Patriarch) on Dec 10, 2008 at 05:51 UTC

    Oops, I was rushed when I wrote that.

    While $_ eq $entry should still be used, it should be after extracting the fields.

    while (<>) { my @fields = split /,/; # Text::CSV_XS would be better. next if $field[0] eq $input{FName} || $field[1] eq $input{LName} || $field[3] eq $input{county}; print; }
    or
    while (<>) { my @fields = split /,/; # Text::CSV_XS would be better. next if $field[0] eq $input{FName} && $field[1] eq $input{LName} && $field[3] eq $input{county}; print; }

    depending on what the OP wants.