Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

underscore _ causing compilation error

Quote Reply
underscore _ causing compilation error
Hi Alex,

I'm working on getting links sql to work with multiple databases and have run into this problem where the underscore character is causing compilation errors. Here's an example of code that works and of code that doesn't. Notice the hyphen and the underscore.
This code is taken from sub html_navigation in Admin_HTML.pm

This Works
a href="editor.cgi?db=$DATABASE-Validate"

Doesn't Work (causes compilation errors)
a href="editor.cgi?db=$DATABASE_Validate"

Could you explain why this is and how to get around it.

Thanks,

Kyle
Quote Reply
Re: underscore _ causing compilation error In reply to
It doesn't work because perl thinks you are trying to use a variable called $DATABASE_VALIDATE, but when you use a dash it thinks you are using just $DATABASE. I assume you just want $DATABASE? If so, then you need to do:

a href="editor.cgi?db=| . $DATABASE. qq|_Validate"

(assuming you are using print qq|)

What that does is stop the qq print statement, then put $DATABASE in, then start printing again. It's a bit of a pain, I know.

Cheers,

Alex