Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl creating new line when I don't want it to

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi all -

I'm pretty new to Perl - but I'm attempting to create a javascript with a cgi script for word definitition (a little tool tip with the definition comes up) The thing is, for the javascript to work, it has to be on 1 line, but Perl is outputting 2 lines of HTML - and the script won't work. I'm not putting any \n anywhere.

Here is what the line should look like to work:

  <A HREF=&quot;docs.html&quot; onMouseOver=&quot;drs('The lady superior of a nunnery.'); return true;&quot; onMouseOut=&quot;nd(); return true;&quot;>abbess</A>.     

Here is what the Perl turns it into:

  <A HREF=&quot;docs.html&quot; onMouseOver=&quot;drs('The lady superior of a nunnery.
'); return true;&quot; onMouseOut=&quot;nd(); return true;&quot;>abbess</A>.     

And here is the relevant Perl scripting:

{


print &quot;$msg)\  <A HREF=\&quot;docs.html\&quot; onMouseOver=\&quot;drs(\'$definition\')\; return true\;\&quot; onMouseOut=\&quot;nd()\; return true\;\&quot;>$word</A>.\ \ \ \ \ &quot;;


Please, any comments on how I can get it to output just 1 line of HTML would be great!

Thanks,


nathan
 

I couldn't tell what was going wrong there, but try using qq~~;

print qq~<a href and all my javascript stuff</a>more stuff
blabla~;

Then you don't have to uncomment anything except any @ symbols.

Tony
 
Tony,

Thanks, but I already tried that. If you follow the following 2 links you'll see what I'm talking about. - the first has all of the source code on line for the javascript and it works mouse over the word &quot;aborignial&quot; - the 2nd page has the same exact code, but on two lines, and the javascript doesn't work - any ideas? - I'vw again posted the relevant Perl code below. Thanks!






print qq~


$msg)&nbsp <A HREF=&quot;docs.html&quot; onMouseOver=&quot;drs('$definition'); return true;&quot; onMouseOut=&quot;nd(); return true;&quot;>$word</A>.&nbsp&nbsp&nbsp&nbsp&nbsp
 
put:
[tt]chomp $definition;[/tt]
before the print statement. &quot;If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top