| |||||||||||
| |||||||||||
Odd linebreak Posted by TedH (TedH), 7 March 2008 Hi, when running some code result through an HTML validator I discovered a linebreak that shouldn't be there. I've looked at this from every angle I can possibly think of and can find no obvious reason for this happening.Code:
The linebreak occurs in the HTML output like this: Code:
The arcdir variable is defined right in the foreach and looks okay in the substring. Is Perl doing something I am not aware of here? Any ideas? - Ted PS If I've mentioned something like this before and forgotten about it, put it down to age (silly grin) Posted by george_Ball (george), 7 March 2008 The newline appears to be in the variable $arcdir, which is the loop control variable stepping through the array @lines. Now I'm guessing that you have filled the array using the <> operator in array context:- @lines = <INPUT>; or something like that. The < > operator leaves the newline on each of the lines that it reads, so you will probably have one of these "phantom" newlines here... My suggestion is to use chomp() to remove the newline (if it's there) on the variable $arcdir before you use it to build the href in your <a> tag. Remember to that chomp() doesn't return the chomped string though, so you can't use the function call in an expression as you may expect. You'll have to do ... chomp ($arcdir); print qq .... ... Hope that makes sense. Posted by TedH (TedH), 7 March 2008 A great big THANK YOU George.The validator returned no errors upon check. Worked a treat. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |