I am working on a bit of logic to be used in a script that copies new files
to a temporary directory and I am stumped.  Basically what I want to
accomplish is to be able to look for the existence of a file name in a log
file, and I am trying to use a hash to accomplish this.

 

$directory is the listing of the current files in the directory

$dir_log currently is file containing the same information as $directory. 

 

I am trying to see if the elements of $directory exist as keys in the hash,
but it isn't working.

 

Suggestions/Observations?

 

 

Terry Poperszky

801-257-5709 Voice

801-924-0649 Fax

[EMAIL PROTECTED]

 

 

 

open MYFILE, "<dir_log";

 

while (<MYFILE>) {

            $dir_log{chomp($_)} = 1;

}

 

chomp ($directory = `dir /b /O-D`);

 

foreach ($directory) {

            print "success" if (exists $dir_log{$directory});

}

Reply via email to