#!/usr/bin/perl -w use strict; use File::Find; my $dir = '.'; find({preprocess => \&before, wanted => \&when, postprocess => \&after}, $dir); sub before { print "hi "; exit 0; } sub after { print "bye "; } sub when { print "file! "; return; }