in reply to Problem with a new line
What exactly does your text document look like with your guestbook entries? Does it look correct with the delimiter?
Check out your for loop...
for my $line (@data_in_the_file) { my @fields = split(/\Q|\E/gm, $line); for my $field (@fields) { print "<br>$field"; } print "<br>______"; }
You loop through every line in the file in the outer loop so if one were to enter a new line in the comment then it would be an additional line, which would mean it would go through the inner code. You have to do a check to see if the line has a "|", your demlimiter and if it does than and only then print our your "
___". Example:
for my $line (@data_in_the_file) { my @fields = split(/\Q|\E/gm, $line); for my $field (@fields) { print "<br>$field"; } print "<br>______" if ($line =~ m/\|/); }
Update: Actually ran a test, I forgot you had to bash slash the delimiter. All you will have to do is add the following to the horizontal bar:
if ($line =~ m/\|/);
|
---|