in reply to Force interpolation on singel quoted strings

Is there an operator that can force interpolation on single quoted strings?
Just use simple double quoting, or a plain old assignment will do in your case (although I can't see why you'd need it).

Also you don't need to escape the forward slash or the astericks[1], as it they will be literally quoted within single quotes. The only thing that can needs to be escaped within a single quotes string is the string delimiter and a backslash (authoritatively covered here by Abigail-II). Check out the perlop manpage for more details about the quoting mechanisms available in perl.
HTH

_________
broquaint

[1] while this is technically correct it doesn't seem to be so in your case (see. Abigail-II's node regarding how to correctly escape these meta-characters)

  • Comment on Re: Force interpolation on singel quoted strings

Replies are listed 'Best First'.
Re: Force interpolation on singel quoted strings
by Abigail-II (Bishop) on Jun 07, 2002 at 12:50 UTC
    The * does need escaping. Not because it's in single quotes, no, the string is in single quotes because he wants the backslash there! The backslash is there to make the regex engine match an asteriks.

    The way to go is not to force interpolation, but to go the other way around. Do something like:

    my $printtag = "/* <sometag */"; my $matchtag = quotemeta $printtag;
    Or (probably more convenient), to just have $printtag and surround that with \Q and \E when putting it in the regex.

    Abigail