|No such thing as a small change|
Interpolation in Single-quotes?by goibhniu (Hermit)
|on May 13, 2008 at 19:22 UTC||Need Help??|
goibhniu has asked for the
wisdom of the Perl Monks concerning the following question:
This is a small thing; I had something unexpected happen. I assumed (always a problem) that single-quoted strings didn't interpolate. Ever. In the following situation, I seem to need an escape-character to keep it from interpolating. If it's not interpolating, why do I need the double-backslash?
This is what fails:
It seems to think $path starts with 'C:\ and extends all the way down to the singlequote in my $otherstring = '. The single quote in the middle is escaped by the backslash. It accepts //Project/ as some sort of search and replace regexp on the implied $_, and is confused by State all by itself after that.
I need to escape the backslash so that it doesn't escape the single quote. If it's not interpolating, why do I need to escape anything?
I'm on WindowsXP / Strawberry Perl 5.8:
#my sig used to say 'I humbly seek wisdom. '. Now it says:
I humbly seek wisdom.