in reply to Help periodically scanning directories to process new files

Here's how I'd do it (untested):
#!/usr/bin/perl -w use strict; my @files = (); my $dir = "/home/dhaffner/src/codemonkey/test"; my $lastUpdate = 0; LOOP: { opendir(DIR, $dir) or die "Died: $!"; @files = grep { -f "$dir/$_" && (stat "$dir/$_")[9] > $lastUpdate +} readdir(DIR); closedir(DIR); GoProcess("$dir/$_") foreach @files; $lastUpdate = time; sleep 30; redo LOOP; }
...but I'm not sure if time() will return the new time, or keep returning the time when the script was first executed. I'll try to find out, and post more in a little while.

Update: Hmm, well I can't find any info one way or the other. It seems like the camel says that time() returns the time when the script started executing, but I can't remember now, and I haven't got the camel here. Anybody?

Update 2: The wise arturo says that time() will return the current time, not just the time the script started... so it should work fine.

Hot Pastrami