my $regex = join '|', map "\Q$_\E?", @filelist; ^ ^ ^ ^^ | | | || | | | |+ - Last character in file name optional, i.e., the "l" in html | | | + - End quote metacharacters | | + - The default scalar aliased to each @filelist element | + - Begin quote metacharacters (e.g., the period) + - Join each element with alternation ("or") character #### 1234567_3a_20101000\.html?|99877_b_20111111\.html?|99877_c_20111111\.html? ... #### ->name(qr/^(?:$regex)$/) ^^^^^^^^^^^^ #### my @matchingFileNames = grep /pattern/, @found_html;