in reply to Re: variable interpolation sans character interpolation
in thread variable interpolation sans character interpolation

Thanks very much, I think this is just what I needed. Just to make certain I understand what is going on,\ here, let me see if I can explain it to myself.

The qr// operator creates a compiled re from the string it is given, and this compiled re can be passed in a variable. However, because it is no longer a string (it is a special variable type??) any backslashes it originally contained are no longer subject to interpolation even when a string which contains it as a variable is itself contained in another string, and so on. Is that about right?

I also think you are right about using an array instead of a hash, particularly because I may want to add more fields to it.

Thanks again.

  • Comment on Re^2: variable interpolation sans character interpolation

Replies are listed 'Best First'.
Re^3: variable interpolation sans character interpolation
by ikegami (Patriarch) on Oct 28, 2005 at 04:28 UTC
    Sounds right. \ is interpretted at compile time in both cases. "..." returns a string with the slashes removed, and qr/.../ returns a compiled regexp (that stringifies to the slashed form, such as when used as a hash key).