You might want to try out using templates for this kind of work as it allows you to separate the HTML from your code. Have a look at
HTML::Template and
Template Toolkit - the former is probably easier to learn but the latter is very powerful.
Using HTML::Template you would create a template file like this:
example.tmpl
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1
+, maximum-scale=1">
<link type="text/css" rel="stylesheet" href="../hideo/bootstrap/cs
+s/bootstrap.min.css">
<!-- etc. fill in rest of head elements -->
</head>
<body>
<!-- RIGHT AFTER <body> TAG -->
<script type="text/javascript" src="../hideo/js-plugin/jquery/jque
+ry-1.10.2.min.js"></script>
<script type="text/javascript" src="../hideo/JQuery/jquery.cycle.a
+ll.2.74.js"></script>
<!-- this will be replaced -->
<TMPL_VAR NAME=CONTENT>
<!-- JUST BEFORE </body> TAG -->
<script type="text/javascript" src="../hideo/bootstrap/js/bootstra
+p.js"></script>
<script type="text/javascript" src="../hideo/js/custom.js"></scrip
+t>
</body>
</html>
Then in your perl script you pass the file to the template engine, and populate it with the other content you want on the page:
use HTML::Template;
my $file = '/path/to/example.tmpl';
my $template = HTML::Template->new( filename => $file );
# do all the work to create the content
my $content = "Start of Content";
# ...
# pass content to the template
$template->param( CONTENT => $content );
print "Content-Type: text/html\n\n";
print $template->output;