Don't know if this helps:  It's from perl.daily.tips

On to the tip: Anyone have seen code like

  print "<a href=\"http://$url/\";>$site</a> (\"$title\")";

Now, it is quite annoying to read all those \'s, so you would think
there is a better way.

Well, there is! :-)

The above line could be written as

  print qq[<a href="http://$url/";>$site</a> ("$title")];

So instead of using " as the quote operator we used qq[ and ] to end
the quote.

You can also use for example qq{ (or any other form of "brackets"), like
  
  print qq{...};


Like "text" can be substituted with qq[text] you can use a single q
for ', so a confusing statement like

  '\'[EMAIL PROTECTED]\''

can be written as

  q['[EMAIL PROTECTED]']

instead.



> From: [EMAIL PROTECTED] (Unknown Sender)
> Newsgroups: perl.beginners.cgi
> Date:     Sun, 3 Jun 2001 00:59:20 -0300 (ADT)
> To:     Derek Duhon <[EMAIL PROTECTED]>
> Cc:     [EMAIL PROTECTED]
> Subject: Re: problem
> 
> You should escape all of the quotes that you want printed.
> 
> print "Content-type:
> text/html\n\n<HTML><HEAD><TITLE>Endless!</TITLE></HEAD><BODY BGCOLOR =
> \"#000000\"><FONT COLOR = \"red\"><H5>$current</H5><HR COLOR = \"red\"><A HREF
> = \"endless?$prev\">Previous Page</a> | <A HREF = \"endless?$next\">Next
> Page</A></FONT></BODY></HTML>";
> 
> 
> Johnathan Thibodeau
> 
> Pound bang user bin perl
> fork while true
> 
> On Sat, 2 Jun 2001, Derek Duhon wrote:
> 
>> I have a print statement that prints out an html page, and after a lot of
>> tinkering, I still can't get it to work.  It prints out the html perfectly,
>> but I can't seem to find a way for it to print the contents of the scalar
>> statements.  The print statement is encased in "".  Here is my source
>> 
>> #!usr/local/bin/perl
>> #
>> #Program to generate endless webpage
>> $current = $ENV{"QUERY_STRING"};
>> $next = ++$current;
>> $prev = --$current;
>> print "Content-type:
>> text/html\n\n<HTML><HEAD><TITLE>Endless!</TITLE></HEAD><BODY BGCOLOR =
>> "#000000"><FONT COLOR = "red"><H5>$current</H5><HR COLOR = "red"><A HREF =
>> "endless?$prev">Previous Page</a> | <A HREF = "endless?$next">Next
>> Page</A></FONT></BODY></HTML>";
>> 
>> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to