On Tue, Mar 25, 2008 at 12:01 PM, Keenlearner <[EMAIL PROTECTED]> 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.

#!/usr/bin/perl

use strict;
use warnings;

my $s = 'foo
$bar
baz';

print "$s\n";

$s = <<'END_OF_STRING';
$s used to hold just:
foo
$bar
baz
END_OF_STRING

print $s;


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

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


Reply via email to