Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, I've got two files - a long CSV file, and another long file with a list of values in it. I need to remove from the long CSV file all of the entries where field 2 in the CSV matches any value in the long file. I can see loading the two into perl arrays, but I'm hoping there is a way to do this without two nested loops inside the perl script. Any suggestions? Thanks
  • Comment on Remove lines from a file based on a second file

Replies are listed 'Best First'.
Re: Remove lines from a file based on a second file
by AR (Friar) on Oct 14, 2011 at 16:36 UTC

    Could you adapt the advice given in this node?

Re: Remove lines from a file based on a second file
by wwe (Friar) on Oct 17, 2011 at 08:43 UTC
    In general first read the file with values into a hash using values as hash keys then loop over the csv file and skip every value which matches a key in a hash. We'll be happy to help you when you show us your code.
Re: Remove lines from a file based on a second file
by Anonymous Monk on Oct 15, 2011 at 06:29 UTC
    load files with DBD::CSV, issue appropriate sql query, be done in time for dinner