Gossamer Forum
Home : General : Perl Programming :

Quote Question

Quote Reply
Quote Question
Code:
$output .= qq~/editors/profiles/$user->{Username}.html\">$user->{Username}</a>~;


Could someone just confirm if I am doing this right?

This statement is deliberately missing the first qoute (this is added somewhere else). But because of this, the second quote (in red) was looking odd, and I thought it might cause errors, even though it is between the qq~ ~;.

Would it be correct to escape this quote as I have done?


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] Quote Question In reply to
There should be no need for you to escape it.

- wil
Quote Reply
Re: [Ian] Quote Question In reply to
No, no escaping is needed. Since you are using qq~, the only chars you need to escape is another ~ (and perl vars like a $ or @ sign).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Quote Question In reply to
Thanks both!

I understand now.Wink


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] Quote Question In reply to
If you don't wish to escape perl vars you can use a single quote....(or q)

$var = 'Ian';

print qq~Hello $var~; # Prints hello Ian

print "Hello $var"; # Print hello Ian

print q~Hello $var~; # Prints hello $var

print 'Hello $var'; # Prints hello $var

You can change ~ to pretty much whatever....eg

print q;Hello;;

I think i mentioned that in another post unless I have dejavu

Last edited by:

Paul: Jun 18, 2002, 5:35 PM
Quote Reply
Re: [Paul] Quote Question In reply to
Hi Paul, another great reference going into my scrap book, thanks!

Yes you did post something along these lines I recall... it was about the ~ symbol, and how it could be any symbol, not just the tild.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Paul] Quote Question In reply to
Yeah. And I quibbled to you about using ; as a deliminator. I personally think it's best to use | as you don't often (never) see this in HTML.

A ; would be very confusing in terms of readability if you were ever to pass your code onto someone else.

Cheers

- wil
Quote Reply
Re: [Wil] Quote Question In reply to
Except in my case... (Yahoo template)... every single page is loaded with the default menu:

Whats Cool | New | Login | Logout etc...


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jun 19, 2002, 8:22 AM