I was attempting to integrate Perl code with JavaScript and came across an issue where I simply wanted to see the output of an Array I have stored within Perl. The following code gives me the proper elements within the array I have stored but I'm not able to see the elements within JavaScript.
my @list_of_vendors;
while(!$resultSet->EOF) {
push @list_of_vendors, $resultSet->Fields("vendor")->Value;
$resultSet->MoveNext;
}
print "The First Vendor is: " . $list_of_vendors[0]. "\n";
This Prints out The First vendor is: 3D Systems The following code doesn't seem to give me the results I want...
print <<ONE;
<html>
<body>
<h4> Test Vendor Array Javascript </h4>
<p id="demo"</p>
<script type="text/javascript" language="JavaScript">
var myVendorArray = @list_of_vendors;
document.write('<p> $list_of_vendors[0] is the same as myVendorArray[0] </p>');
</script>
</body>
</html>
ONE
I thought this would give me 3D Systems is the same as 3D Systems but it gives a blank for the html screen.
Can anyone point out to me what I might be doing wrong? Or point me in the right direction to debug this using notepad++ or some other useful IDE for this. Thanks a bunch!!
3D Systems is the same as3D Systems` on the html page... but for some reason this is not showing...@list_of_vendorscome back with a long string of vendors instead of being an array...Thanks for the suggestion #feelslikeanoob