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 are stored in
C:\\Program Files
';
print $s;

$s = <<'EOS';
My programs are stored in
C:\\Program Files
EOS
print $s;

C:\home>perl test.pl
My programs are stored in
C:\Program Files
My programs are stored in
C:\\Program Files

C:\home>

A single quotes here-document is the safest way to ensure that nothing gets changed.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

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


Reply via email to