my @starters = @ARGV ? @ARGV : ('./beginning_includes'); #current directory @ARGV = (); find sub { push @ARGV, $File::Find::name if $File::Find::name =~ /.txt$/i; # or whatever condition here }, @starters; die "nothing to replace" unless @ARGV; }