You may be using one language to generate code for the other, or maybe you found a way to use both languages together, but with normal CGI programming, you have strict separation of client and server side.
You needed some Perl to fill a JS array. Surprise: that has nothing to do with JS, only with its syntax. You would probably want to generate JS, which is (from Perl's view) just a string of code:
Or something like that.my @foo = qw(foo bar baz); my $js = 'foo = new Array(' . join(', ', map "'\Q$_\E'", @foo) . ');';
That is HTTP, HTML, CGI and server maintenance related. It is NOT Perl related! CGI can be written in any programming language that can handle environment variables and stdin/stdout. Yes, you can write CGI programs in C, GW-Basic, Pascal, Visual Basic or even Brainfuck if you don't care about the environment variables.