Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Problem with a new line

by tptass (Sexton)
on Aug 06, 2008 at 22:37 UTC ( #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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2023-12-06 20:34 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (31 votes). Check out past polls.