## This code has no checking at all. use strict; use warnings; use Linux::Inotify; my $notifier = Linux::Inotify->new(); my $watch = $notifier->add_watch('.', Linux::Inotify::CREATE); sub do_create { print "File $_[0] created\n"; unlink $_[0]; ## Just for fun } my %dt = ( create => \&do_create, ); for (;;) { my @events = $notifier->read(); for (@events) { $dt{$_->type()}->($_->fullname()); } }