<p>I have the following string:</p>

<p><code>$_='364*84252';</code></p>

<p>The question is: how to replace <code>*</code> in the string with something else? I've tried <code>s/\*/$i/</code>, but there is an error:  <code>Quantifier follows nothing in regex</code>. On the other hand <code>s/'*'/$i/</code> doesn't cause any errors, but it also doesn't seem to have any effect at all.</p>

Something else is weird here...
```
```
~> cat test.pl
$a = "234*343";
$i = "FOO";

$a =~ s/\*/$i/;
print $a;

~> perl test.pl
234FOO343
```
```
Found something:
```
```
~> cat test.pl
$a = "234*343";
$i = "*4";

$a =~ m/$i/;
print $a;

~> perl test.pl
Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE 4/ at test.pl line 4.
```
```
Solution, escape the special characters from the variable using
```
\Q
```
and
```
\E
```
, for example (TIMTOWTDI)
```
```
~> cat test.pl
$a = "234*343";
$i = "*4";

$a =~ m/\Q$i\E/;
print $a;

~> perl test.pl
234*343
```
```