find(\&wanted, $dir); my @file_list; sub wanted{ next if (-l && !-e ); push (@file_list, $File::Find::name) if ((($_ =~ m/.txt$/gi) && ($_ !~ m/category.txt$/gi)) || ($_ =~ m/.jpg$/gi) || ($_=~ m/.tif$/gi)); }