Link to home
Start Free TrialLog in
Avatar of johnclarke
johnclarke

asked on

Removing carriage returns from a string

I am currently using CGI-LIB.pl in my Perl CGI programs.  When I retrieve values from a multi line text area it is possible that the value returned could have carriage returns in it.  Is there anyway to examine this value and remove all carriage returns that are embedded in it ?

I would be grateful for all help offered regarding this.

Thanks in advance

John
Avatar of thoellri
thoellri

$field =~ s/[\n\r]//g;

will strip out all carriage return linefeed characters.

hope this helps
  tobias
ASKER CERTIFIED SOLUTION
Avatar of amitpagarwal
amitpagarwal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And that adds what substantial piece of information to my post?
Avatar of ozo
or you might want to say something like
s/\s/ /g