note
Khen1950fx
It actually was working just as it should work. I called scan twice, so it shut down. I don't think that you need a while loop. For example, you can turn on the monitor, and it will dutifully observe what it's supposed to watch:
<c>#!/usr/bin/perl
use strict;
use warnings;
use File::Monitor;
my @Files = qw(1.doc 2.doc 3.xls);
my $wFileMonitor = File::Monitor->new();
foreach my $wFile(@Files){
$wFileMonitor->watch($wFile);
}
$wFileMonitor->scan;
</c>
Now the monitor is on. It will stay on until you call the second scan---then it reports the changes and shuts off.
872039
872100