in reply to Adding file to directory notification
You use a hash instead of an array because you're searching for stuff (in this case filenames), which is faster and easier using hashes.use strict; opendir(DIR,$newfile) or die "Blerch: $!\n"; my %files=map {$_,1} readdir(DIR); #assume %oldfiles was set before in a similar way foreach my $file (keys %newfiles) { unless (exists $oldfiles{$file}) do_we_have_a_new_file(); #Cheers an +d happiness!! }
Beware that this code is untested and might do unpredictable things, including actually working.
CU
Robartes-
Update: Corrected some silly syntax mistakes.
|
|---|