in reply to 'Here Documents' and unrecognized escapes

Normal strings created with single or double quotes (or q// and qq// operators) can be multiline:
$ perl -le ' > use strict; > use warnings; > my $c = "multi line > content spanning > over three lines"; > print $c; > ' multi line content spanning over three lines
But of course it would not be practical to use double quotes in your case, because you need double quotes within your template. However, single quotes or the q{} quote-like operator should be fine.

Otherwise, using single quotes for introducing the 'HERE' tag will prevent any interpolation:

use strict; use warnings; my $chapter_template=<<'HERE'; <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/T +R/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml +; charset=utf-8" /> <link type="text/css" rel="stylesheet" href="..\css\style_shee +t.css" /> <title>*****ebook title goes here*****</title> <meta name="author" content="*****ebook author name(first, las +t) goes here*****" /> </head> <body> <h2 class="ebook" id="LinkID*****current link goes here*****"> +Chapter *****current chapter number goes here*****</h2> <p class="ebook">*****ebook content goes here onwards*****</p> </body> </html> HERE ; print $chapter_template;
This happily prints the content of the here doc.

Replies are listed 'Best First'.
Re^2: 'Here Documents' and unrecognized escapes
by morelenmir (Beadle) on May 04, 2014 at 16:05 UTC

    MANY thanks - that sorts it out entirely! I shall give the 'template' library a look over as well as it may offer a better total solution

    "Aure Entuluva!" - Hurin Thalion at the Nirnaeth Arnoediad.