open my $inotify, '-|', do { no warnings 'qw'; qw( inotifywait -m -r -e close_write -e moved_to --exclude /\.git/|~$|/#[^/]+# . ) } or die $!; while (<$inotify>) { my ($path, $event, $file) = split; $thread_queue->enqueue("$path$file") if $event =~ /$expected/; }