in reply to Re^3: Running JavaScript from within Perl
in thread Running JavaScript from within Perl

As hippo mentioned, chomp. See also https://perlmaven.com/open-and-read-from-files:

"In this article we see how to do this with core perl, but there are more modern and nicer ways to do this using Path::Tiny to read files."

In addition to that you should consider properly indenting your code to make it easier to follow.

  • Comment on Re^4: Running JavaScript from within Perl