Connecting Tech Pros Worldwide Help | Site Map

Removing line break character and space from form data

Newbie
 
Join Date: Jan 2008
Posts: 4
#1: Oct 30 '08
Hi all,

Tricky question. I know how to remove line break characters and spaces by
using the code below:


$message =~ s/\n//g;
$message =~ s/\s//g;


........... how do you do it if you do not want to remove the first line break??? - but then remove the rest. So in other words, you want to skip the first line break.

Thanks in advance,
mccalla
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#2: Oct 30 '08

re: Removing line break character and space from form data


There will be a number of ways to do this. Heres one way:

Expand|Select|Wrap|Line Numbers
  1. $message =~ s/\n/[n]/;
  2. $message =~ s/\n//g;
  3. $message =~ s/\[n\]/\n/;
  4.  
Reply