my $regex = join '|', map "\Q$_\E?", @filelist; my $find = File::Find::Rule ->file ->name(qr/^(?:$regex)$/) ->start( $dir ); while ( defined( my $html_document = $find->match ) ) { push @found_html, $html_document; } $f_count = scalar @found_html; #### 1234567_3a_20101000\.html?|99877_b_20111111\.html?|99877_c_20111111\.html?|99877_d_20111111\.html?|99877_e_20111111\.html?|99877_uf_20111111\.html?|1234567_g_20101000\.html?|99877_h_20111111\.html?|99877_i_20111111\.html?|99877_j_20111111\.html?|99877_k_20111111\.html?|99877_ll_20111111\.html?|1234567_pl_20101000\.html?|99877_qa_20111111\.html?|99877_rr_20111111\.html?|99877_sx_20111111\.html?|99877_xy_20111111\.html?|99877_nm_20111111\.html?