Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

Re: Inserting JavaScript into Perl Script

by tadman (Prior)
on Nov 18, 2002 at 02:14 UTC ( [id://213639]=note: print w/replies, xml ) Need Help??

in reply to Inserting javascript into perl script

A quick idea of what you can do:
print <<END; // JavaScript goes here // large quantities. END # Perl continues here
The last part can be changed to 'END' if you want to prevent variables such as $foo from being interpolated. Of course, you might want this, so the option is there.

Another way to do this is using standard quotation:
print qq~ // JavaScript goes here // long as there's no tildes (which end it) ~; # Perl continues here
As a tip, qq interpolates like double quotes, while q alone is like a single quoted string. Carefully choose your delimiter, though, since it can confuse the parser if it appears within your JavaScript. Tilde is a fairly safe bet, I would presume.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://213639]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2024-07-17 13:16 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.