--- Eric Hanigan <[EMAIL PROTECTED]> wrote:
> Hello,
> Real greenhorn here. I'm modifying a discussion board script which
> writes to an html file. I'm trying to insert the following into the
> file: 
>     <!--#include file="titlepic.shtml"-->
> So, I put this in the script:
>     print "   <!--#include file="titlepic.shtml"-->\n";
> 
> I'm getting syntax errors. I'm pretty sure it's from the quote
> character before the word titlepic (that's what I think the error log
> on the server is telling me). That quote is closing off an argument,
> right?

I'd say so. =o)
 
> How do I nest the quoted material within the other quotes? I've tried
> qq and \Q amongst other things, but I don't know what I'm doing.

LOTS of options. =o)

First, the internal quotes are probably not really necessary, if you're
willing no be out of true on your HTML specs.

     print "   <!--#include file=titlepic.shtml-->\n";

Not a good habit, but it'd likely work.
Better, switch quotes:

     print "   <!--#include file='titlepic.shtml'-->\n";

Sometimes that's not going to do, such as when you have to print an
HREF with a javascript mouseOver, so you can use qq:

 print qq{<a href=foo,htm onMouseOver="window.status='hi!';
                                       return true;">\n};

(And yes, you can even embed that newline.)

Or my personal favorite, the "here-document". This is a
little-documented Perl feature that has saved me a lot of trouble.

print<<END;
     <!--#include file="titlepic.shtml"-->
END

You can even do assignments to variables with this, which works great
for javascript you need to write to several consecutive pages, for
example when you use code to write hard pages to disk:

my $js=<<'END'; # and comments here are ok, too!

 write whole javascript functions here, with embedded nested quotes and
whatever else. Because I quoted 'END' in the =<<'END' above, everything
is kept exactly as in single-ticks. This text runs until it finds END
on a line by itself, though leading whitespace causes confusion. 

END

Hopefully that's more than you need without getting you confused. Play
with it some. It'll work.

Drop me another note if it doesn't!

Paul

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to