[thelist] What characters to 'escape' Perl?

Tobyn Baugher toby at rsux.com
Mon Feb 24 22:45:01 CST 2003

On Monday, February 24, 2003 8:16 PM -0800 Anthony Baratta
<Anthony at Baratta.com> wrote:

> If you are really stringing together print statements like that, I
> prefer this method:
> print qq[Content-type: text/html
> ];
> As long as you don't use [] in your text.

'Here document' syntax is also quite useful if you're going to do one
big multi-line print statement. Something like

print <<END_OF_MY_HTML;
Content-type: text/html

<body bgcolor="$BodyColor">

<td width="33%" align="middle">
<td width="100" bgcolor="$TableColor">
     <font face="Arial,Helvetica" color="$TableFont">To:</font>
<!-- Copyright 1999-2002 -->

lets you avoid worrying about using one magical character for your
quote delimiter. Just don't put END_OF_MY_HTML on a line by itself
inside your actual HTML and you're good to go :).

Tobyn Baugher <toby at rsux.com>
aim: dieplzkthxbye  icq: 14281524  efnet: toby

More information about the thelist mailing list