in reply to Adding file to directory notification

One simple way is to keep a hash with the previous filelist in it. Something like:
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!! }
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.

Beware that this code is untested and might do unpredictable things, including actually working.

CU
Robartes-

Update: Corrected some silly syntax mistakes.