in reply to Automation with Perl

See INotify, Dir::Watch, File::ChangeNotify.

For examples, see the linked modules.