develooper Front page | perl.beginners | Postings from March 2008

Really literal string

Thread Next
From:
Keenlearner
Date:
March 25, 2008 09:37
Subject:
Really literal string
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.


Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About