Posted by TedH (TedH), 7 March 2008Hi, 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.
The linebreak occurs in the HTML output like this:
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?
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 2008The 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
print qq ....
Hope that makes sense.
Posted by TedH (TedH), 7 March 2008A great big THANK YOU George.
The validator returned no errors upon check. Worked a treat.
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho