How to escape Perl regular expression characters in array and in grep?
<p>I have two questions but also could be so easy to answer. Probably just a newbie questions. There is little about this on Google.</p>

<p>First: How do you put Perl matching operators in array?
For example all of these characters:</p>

<pre><code>{}[]()^$.|*+?\
</code></pre>

<p>to use then with foreach?</p>

<p>Second, if you have this:</p>

<pre><code>@array = qw(The $ quick ? brown | fox jumps over the lazy dog);

$string = "\? brown \|";

@new_array = grep(/$string/,@array);
</code></pre>

<p>How to properly find $string in the @array if @array is some text for example which contains dollar sign, question mark etc.? If you search regex character it will turn into operator. And if you do this: </p>

<pre><code>$string =~ s/\$/\$/gi; 
</code></pre>

<p>it will have the same result of course.</p>

<p>Thanks in advance.</p>