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.
In reply to Re^4: Running JavaScript from within Perl
by marto
in thread Running JavaScript from within Perl
by anautismobserver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |