#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use File::Find; open (my $t, '>', '/home/myuser/myfilename.sql') or die $!; print $t "blah blah\n"; find( { preprocess => \&hi, wanted => \&work, postprocess => \&bye, follow_skip => 1 }, "."); sub hi { print $t "hi\n"; return;} # works correctly sub bye { print $t "bye\n"; return;} # works correctly sub work { print "my name is: ", $File::Find::name; print $t "I'm a file!"; return;} close $t; #### blah blah hi I'm a file!I'm a file!I'm a file!... etc bye #### blah blah hi bye I'm a file! <-yep, solitary and in the wrong position