<?xml version="1.0" encoding="windows-1252"?>
<node id="1013922" title="Re: CGI redirection" created="2013-01-17 19:33:55" updated="2013-01-17 19:33:55">
<type id="11">
note</type>
<author id="805072">
7stud</author>
<data>
<field name="doctext">
&lt;p&gt;Also, if you find yourself escaping lots of characters inside a string, you are not taking advantage of perl's numerous quoting mechanisms.  Look here:&lt;/p&gt;

&lt;code&gt;
my $html = &lt;&lt;END_OF_HTML;
&lt;html&gt;
  &lt;head&gt;&lt;title&gt;Web redirection&lt;/title&gt;
  &lt;/head&gt;
&lt;body&gt;
    &lt;form action="redirect.pl" method="post" &gt;
    &lt;fieldset&gt;
    &lt;legend&gt;Kindly select a website to visit&lt;/legend&gt;
    &lt;strong&gt;Select a website form the list:&lt;/strong&gt;
    &lt;select name="website"&gt;
    &lt;option value="www.sedocaonline.com"&gt;Sedocaonline.com&lt;/option&gt;
    &lt;option value="http://www.yahoo.co.uk"&gt;Yahoo.co.uk&lt;/option&gt;
    &lt;option value="http://www.play.com"&gt;play.com&lt;/option&gt;
    &lt;/select&gt;
    &lt;input type="hidden" name="op" value="ds" &gt;
    &lt;input type="submit" name="submit" value="Browse the web"&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
END_OF_HTML

print $html;&lt;/code&gt;
&lt;p&gt;That's called the 'here doc' syntax.  Perl also has q{} and qq{}:
&lt;code&gt;
use strict; 
use warnings; 
use 5.012;

my $greeting = 'hello';
my $str1 = q{The lady said $greeting to me.};
my $str2 = qq{The lady said $greeting to me};

say $str1;
say $str2;

--output:--
The lady said $greeting to me.
The lady said hello to me.
&lt;/code&gt;
&lt;p&gt;q{} is an alternative to single quotes, and qq{} is an alternative to double quotes--and you can use any delimiter you want:&lt;/p&gt;

&lt;code&gt; 
say q['hello' {world}];
say q*hello ["'] world*;


--output:--
'hello' {world}
hello ["'] world&lt;/code&gt;

</field>
<field name="root_node">
1013782</field>
<field name="parent_node">
1013782</field>
</data>
</node>
