Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have discovered that if $var contains a set of parentheses, this does not work as expected (the text does not get removed).
I don't really understand the theory behind this (or what exactly happens), but I assume that I need to somehow pass the variable in a way to tell perl that I want to use the literal variable.
How do I do that? And what exactly does perl try to do with:
$var = 'apple (banana) cherry'; $line = 'apple (banana) cherry kiwi lemon melon'; $line =~ s/$var//;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: newbie quoting question
by blakem (Monsignor) on Sep 23, 2001 at 04:01 UTC | |
|
Re: newbie quoting question
by John M. Dlugosz (Monsignor) on Sep 23, 2001 at 07:04 UTC | |
|
Re: newbie quoting question
by George_Sherston (Vicar) on Sep 23, 2001 at 16:27 UTC | |
|
Re: newbie quoting question
by NearO (Scribe) on Sep 24, 2001 at 12:46 UTC |