Cameron's solution is far simpler, but since you are attempting to do this
in perl, I'll tell you why your comparison is failing
On Fri, 9 Feb 2001, K Old wrote:
> Hello,
>
> I'm trying to write a script that will recurse through a directory structure
> and write all files not specified in a "control" file into a second file.
> So, to break it down. I would give you file with a list of filepaths each
> one on a new line (i.e. /docroot/bvdev1/index.html). I would then run the
> script starting in a certain directory (i.e. /docroot/bvdev1/). It would
> then write out all files not listed in the first file to a second file.
> Because /docroot/bvdev1/index.html was in the first file, it would not be
> written into the second file. /docroot/bvdev1/webmaster.html would be
> written to the second file.
>
> I have attempted at this script and have gotten stuck when trying to do the
> matching. What I have so far is below.
<snip>
> foreach $item (@control_list) {
> chop($item);
> foreach $file (@files) {
> chop($file);
> if($file == $item) {
> print "$item";
> }
> }
> }
You are using the '==' which is used to compare two numbers. Try using
'eq' instead, which will treat it's arguments as strings.
hth
charles
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list