use File::DosGlob; $fn = 'c:/temp/*'; my @m = File::DosGlob::doglob(1,$fn); for (@m) { # if directory add contents to end of Array push @m, File::DosGlob::doglob(1,$_.'/*') if -d($_); if (m!^.*/xxxx!) { # if filename starts with xxxx do_something_with($_); } }