Please re-read my post at Re^2: Compare 2 arrays. This does take into account the *.nfo files in the SDF file. The code from stevieb can also be adjusted to do this. The Monks expect that you spend some time analyzing and understanding the code that is being written for you. You have a couple of approaches and both will work.

Test in small increments. For example to parse the SDF file, you could break out my code into a short test program like this:

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %keepList; while (my $line = <DATA>) { my $sdf_file; next unless ($sdf_file) = $line =~ /(\w+\.nfo)/; $keepList{$sdf_file} = 1; print "keeping $sdf_file\n"; #update for debugging ####### } =example printout keeping filename1.nfo keeping filename2.nfo =cut __DATA__ fullpath="C:\directory\filename1.nfo" id="1a" fullpath="C:\directory\filename2.nfo"
As a note: If you are using Windows file names with a space in them, then the regex would be different. I only use filenames that are compatible with both Unix and Windows and that is probably the case here, but it may not be. One reason to run a simple test on the actual file!

update: I should clarify, when you have a choice, use only [a-zA-Z0-9_], in the file names, basically anything that meets the rules of a valid identifier in Perl or C is fine, what Perl calls \w characters. Forgo using spaces or dashes in the names if you can and your life will be easier.


In reply to Re^3: Compare 2 arrays by Marshall
in thread Compare 2 arrays by niceguy

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.