From: Keenlearner <[EMAIL PROTECTED]>
> 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.

Please compare

my $you = 'Keenlearner';
print "Hi $you\n";
print 'Hi $you\n';
print "\n\n";


print qq{Hi $you\n};
print q{Hi $you\n};
print "\n\n";


print <<TEXT;
Hi $you
What's up?
TEXT

print <<"TEXT";
Hi $you
What's up?
TEXT

print <<'TEXT';
Hi $you
What's up?
TEXT



HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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


Reply via email to