in reply to Re^2: Compare 2 arrays
in thread Compare 2 arrays
Test in small increments. For example to parse the SDF file, you could break out my code into a short test program like this:
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!#!/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"
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Compare 2 arrays
by niceguy (Initiate) on Jun 29, 2016 at 22:10 UTC | |
by Marshall (Canon) on Jun 30, 2016 at 00:01 UTC | |
by Anonymous Monk on Jul 01, 2016 at 17:43 UTC |