Matching an array of strings to strings in a file.

Yitzchak Scott-Thoennes sthoenna at
Mon Aug 29 21:09:35 BST 2011

On Mon, Aug 29, 2011 at 9:36 AM, Randal L. Schwartz
<merlyn at> wrote:
>>>>>> "Gianni" == Gianni Ceccarelli <dakkar at> writes:
> Gianni>     my $rx = join '|',map { "\Q$_\E" } @$strings;
> No need for \E if you're already at the end of the string.
> And I'd change that to just
>  quotemeta $_
> to make it clearer, and avoid the one layer of copying.

Clearer obviously being the more significant motive.

Though I find this even clearer:

    my $rx = join '|', map quotemeta, @$strings;

More information about the mailing list