here documents

  • Thread starter Rainer Weikusat
  • Start date


Rainer Weikusat

I'm currently forced to use/ write some non-entirely-trivial Javascript
code for the first time in my life. This code is going to be mostly
static with a few (one or two) parameters interpolated into it. And I
need to use it in the context of more than one 'generated web
page'. Because of this, I'm using a dedicated CGI script to write this
code and presently, the relevant section looks like this (trivial early
example because I'm not really familiar with the language and need to
'find a way through it' first):

print("Content-Type: text/javascript\n\n");
printf(<<TT, $name);
function showName()
setTimeout(showName, 5000)

setTimeout(showName, 5000)

Something like this was posted as supposedly deterrent example here a
while ago. In contrast to that, I think this is really an example of a
here-document coming in extremely handy because I can just put the
alien code into the Perl-script without it tripping up my editor and
without using a strangely-formatted printf-statement.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question