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.$ perl -le ' > use strict; > use warnings; > my $c = "multi line > content spanning > over three lines"; > print $c; > ' multi line content spanning over three lines
Otherwise, using single quotes for introducing the 'HERE' tag will prevent any interpolation:
This happily prints the content of the here doc.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;
In reply to Re: 'Here Documents' and unrecognized escapes
by Laurent_R
in thread 'Here Documents' and unrecognized escapes
by morelenmir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |