in reply to saving output of javascript

Perl web-programs work on server-side.
Javascript is on client-side.
So Perl has nothing to do with the output of js.
Have in mind that this file will be created on the client's hard disk.
See javascript FileSystemObject for more information.