Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Problem with a new line

by tptass (Sexton)
on Aug 06, 2008 at 22:37 UTC ( [id://702764]=note: print w/replies, xml ) Need Help??


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/\|/);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://702764]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-23 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found