You could use a 'here document' construct
#!/usr/bin/perl use strict; use warnings; # --- HERE document construct my $page = <<END_OF_HTML ; <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> [snip some html] <title>Your title</title> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> </head> <body> <h1>Hello, world!</h1> [snip some html] <script src="js/bootstrap.min.js"></script> </body> </html> END_OF_HTML print $page; print "=" x 50; sub body_generate { my $tmp; $tmp = "<h1>Subroutines or functions can be called too!</h1>"; return $tmp; } my $subject = "Test for embedding variables in here document"; my $page2 = <<END_OF_HTML; <title>$subject</title> <body> @{ [ body_generate ] } <p>For details see 'Perl Cookbook', recipe 1.10 "Interpolating functio +ns and expressions within strings. </p> </body> END_OF_HTML print $page2;

See http://www.stonehenge.com/merlyn/UnixReview/col12.html for what happens is you use the different types of quotes around the here document marker (END_OF_HTML)


In reply to Re: How To Use Bootstrap Code in Perl Script? by Hadrianus
in thread How To Use Bootstrap Code in Perl Script? by glennpm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.