in reply to Efficient multiplatform directory polling

I think the most cross-platform portable way to do this is polling, but glob and stat are actually pretty quick:

sub getNewestFile { my $dir=shift; my @files=glob "$dir/*"; my %mtimes; map { $mtimes{$_}=(stat $_)[9] } @files; @files=sort { $mtimes{$b}<=>$mtimes{$a} } keys %mtimes; $files[0]; }

See what you think, burden on your system should be minimal if you do it less than once every second.

HTH,
SSF