![]() |
|
No such thing as a small change | |
PerlMonks |
Re: Where are these newlines coming from?by Speedy (Monk) |
on Feb 15, 2002 at 23:50 UTC ( [id://145789]=note: print w/replies, xml ) | Need Help?? |
I've run into these "ending" problems with the input from Web browser "textarea" form boxes with browsers running on different platforms -- on say Windows, Linux and Macintosh. In a form textarea box most Windows browsers (esp. MS IE) after an "enter" or "return" produce a lfcr, on Linux just a lf, and on a Mac browser just a cr (since each plaform developers had differing notions of what constitutes a line break). Below is the rather inelegant code I used then to display the results on the browser screen (which being HTML wants a <br>, and in the file system of the UNIX box the data were being saved to, which whats a '\n' or lf. $phrases was the return parameter from a browser textarea box which could have one or more lines with endings generated by the "enter" key. Must be an easier way, but this got the list in $phrases displayed properly in the browser, and saved with a single "\n" for line endings regardless of which browser it came from. Live in the moment
In Section
Seekers of Perl Wisdom
|
|