I am currently working on creating a unique JavaScript string using q{} like this:
my $javascript = q{
$(function () {
var chart;
$(document).ready(function () {
// Build the chart
$(\'#container\').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: \'title\'
},
};
The challenge lies in structuring it into segments rather than complete JavaScript blocks. The issue I face is that since the block is not complete, it contains open brackets '{' without closing brackets, causing Perl to interpret the closing bracket for q{} as the end of one of the JavaScript blocks. I attempted using q() instead, but encountered the same problem. Is there an alternative delimiter other than ( or { that I can use? I also experimented with qq, but faced similar issues and additional escaping requirements. While I understand that I can achieve this without using q or qq by writing individual lines, the cleaner format is preferable. I am determined to find a solution and believe there must be a way to make this work. Thank you!