use strict; use warnings; use Mojolicious::Lite; get '/' => sub { my $c = shift; my @array = qw( foo bar baz qux ); $c->stash( vars => \@array ); $c->render( template => 'js', format => 'html' ); }; app->start; __DATA__ @@ js.html.ep