Keenlearner wrote:
I like to store multiline perl code inside a scalar variable, but I
don't want perl to interpolate the variable inside the code.

my $t = "abc";

my $s = <<TEXT;
This is a test $t
TEXT

The above code still interpolate the string. I know that I can escape
the variable with backslash, but the code inside is much more
complicated than that as the would be subroutine as well. Any method
that I can use ? Thank you.

If you put your terminating identifier in single-quotes, it behaves as
if the entire here-document is in single-quotes:

my $s = << 'TEXT';
This is a test $t
TEXT

HTH,

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to