Perl can't run Java script itself. One solution is to use:
WWW::Mechanize::Chrome. Previously it was possible to automate Firefox and I played with that, but unfortunately Firefox took out the interface that allowed the automation to happen. I haven't used the Chrome version yet. Anyway the idea is to have Perl control Chrome which will run the Javascript code. Then you read what Chrome figured out.