Chas. Owens wrote:
#!/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;
It should be noted that those methods are not quite equivalent.
C:\home>type test.pl
my $s = 'My programs
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 = <
Use single quotes.
my $s = <<'TEXT';
http://perldoc.perl.org/perlop.html#Single-Quotes
--
Gunnar Hjalmarsson
Email
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 = < This is a test $t
> TEXT
>
> The above code still interpolate the string. I know that I can
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 = < This is a test $t
> TEXT
>
> The above code still inte
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 = <
If you put your terminating identifier in single-quotes, it behaves as
if the entire here-document is in single-quotes: