By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,081 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

Removing line break character and space from form data

P: 4
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
Oct 30 '08 #1
Share this Question
Share on Google+
1 Reply


KevinADC
Expert 2.5K+
P: 4,059
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.  
Oct 30 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.