freelanceprogrammers.org Forum Index » Perl
line brakes
Joined: 24 Oct 1999
Posts: 2
line brakes
I have a text area , when submitting the data I want to remove all the line
brakes who can I do that in perl ? <br><br>How Can I replace line bakes (
chr(10) ) with <br> ?
Joined: 07 Jul 1999
Posts: 4
line brakes
To change line breaks to the string <br> you could try<br><br>|
s/
/<br>/g;<br><br>or a variant on it. Is this what you were looking
for?
Joined: 28 Oct 1999
Posts: 1
line brakes
Well, there`s two ways to replace the line
breaks:<br><br>First, you could just replace them with "tr", like
so:<br><br>$string =~ tr/
/<br>/;<br><br>Or, you could turn
it into a list and then print each item with a
<br> after it, like this:<br><br>@lines = split(/
/,
$string);<br>foreach $line (@lines) {<br> print
"$line<br>
";<br>}<br><br>Either way would work. At least they did for
me!<br><br>P.S. I know there`s a trailing <br> at the end
if you use the second method....if you need help
getting rid of that just holler!
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







