Perl Text: Quoting Without Quote Marks - Formatting with the Here Document (
Page 3 of 4 )
Another benefit to the here document is the ability to format your text and have it appear exactly as you typed it in. Here is a poem that we will display using the here document:
#!/usr/bin/perl
$twain= <<'Poem';
Warm summer sun,
Shine kindly here,
Warm southern wind,
Blow softly here.
Green sod above,
Lie light, lie light.
Good night, dear heart,
Good night, good night.
Poem
print $twain;
This will display Twain's poem like so:
Warm summer sun,
Shine kindly here.
Warm southern wind,
Blow softly here.
Green sod above,
Lie light, lie light.
Good night, dear heart,
Good night, good night.

|