From: "Quelance" <[EMAIL PROTECTED]> > replace any matched spaces with > replace a new line with <br> > > .... > while(<INFILE>) { > s/\s/ /; #replace spaces with > s/\n/<br>\n/; #replace newlines with <br> > print $_; > print OUTFILE $_; > > }
1. If you did not play tricks with $/ then the $_ only contains one line on each iteration. So you do not have to search for newlines by a regexp. I would suggest chomp()ing the line and appending "<BR>\n". 2. you are missing a /g option on the regexp. This way you'll only replace the first space on the line. while(<INFILE>) { chomp; s/\s/ /g; #replace spaces with $_ .= "<BR>\n"; print $_; print OUTFILE $_; } Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]