#!/usr/bin/perl # http://perlmonks.org/?node_id=1206910 use strict; use warnings; use File::Find; $| = 1; my $dir = 'A'; find({preprocess => \&before, wanted => \&when, postprocess => \&after}, $dir); sub before { print "hi "; sort @_ } sub after { print "bye " } sub when { print "file! $File::Find::name " }