Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

removing returns from a submited text box

by transmission_err (Initiate)
on Nov 23, 2001 at 02:56 UTC ( [id://127034]=perlquestion: print w/replies, xml ) Need Help??

transmission_err has asked for the wisdom of the Perl Monks concerning the following question:

i need to take the text from the box and write it to a document, but i dont want it to print any returns. i tried $INPUT{'post'} =~s/\n//g; ,but that only worked half the time.
  • Comment on removing returns from a submited text box

Replies are listed 'Best First'.
Re: removing returns from a submited text box
by CharlesClarkson (Curate) on Nov 23, 2001 at 18:40 UTC

    s|\n||gm; will rid you of all newlines (\n) by treating the string as multiple lines. It will also eliminate white space between words. s|\n| |gm; will replace newlines with a space. </CODE>

Re: removing returns from a submited text box
by TomK32 (Monk) on Nov 23, 2001 at 10:54 UTC
    I've tried it myself and had no problem, but maybe you should try s/\n//gm or put the \n into ()'s at best post the strings that troule you

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-09-13 20:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (21 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.