I have a small script that reads a text/flat file database and creates links from the returned results. It works fine except it is including the breaks in the results to which is messing up the html:
Here's the script:
----------------------------------
#!/usr/bin/perl
print "Content-type:text/html\n\n";
open(INFO, "../list.txt");
@array=<INFO>;
close (INFO);
foreach $keyword(@array){
$keywordhypen=$keyword;
$keywordhypen=~tr/ /-/;
$keystring='<a href="'.$keywordhypen.'.html">'.$keyword.'</a><br>';
print<<End_of_File;
$keystring
End_of_File
}
----------------------------------
which produces html like:
<a href="word-one
.html">word one
</a><br>
<a href="word-two
.html">word two
</a><br>
As you can see everytime one of the variables is printed it also prints a new line break. Is there anyway to make it so the code prints this instead:
<a href="word-one.html">word one</a><br>
<a href="word-two.html">word two</a><br>
I have NO idea how you would.
Cheers
Chris