use strict; use File::Find; find( sub { return unless -f $_ and /\.html?$/; # do your funky thang }, shift || '.' );