I just cant seem to remove the “ExcludedFolders” values from the “Folders” array here is what I have, any help in appreciated.
CODE:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
my @ExcludedFolders = qw(
/this/is/folder/path/one/exclude
/this/is/folder/path/three/exclude
/this/is/folder/path/five/exclude
);
my @Folders = qw(
/this/is/folder/path/one/exclude/some/file.dat
/this/is/folder/path/two/exclude/some/file.dat
/this/is/folder/path/three/exclud/some/file.dat
/this/is/folder/path/four/excludee/some/file.dat
/this/is/folder/path/five/exclude/some/file.dat
/this/is/folder/path/six/exclude/some/file.dat
);
my %remove;
@remove{@ExcludedFolders}=();
@Folders=grep{!exists$remove{$_}}@Folders;
foreach my $Path (@Folders) {
print "$Path \n";
}
Thanks
It’s not working because
'/this/is/folder/path/one/exclude/some/file.dat'doesn’t exist in the%removehash;'/this/is/folder/path/one/exclude/'does.I’d recommend using
Tie::RegexpHashhere: