467,110 Members | 1,339 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,110 developers. It's quick & easy.

Removing line break character and space from form data

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,
Oct 30 '08 #1
  • viewed: 4361
1 Reply
Expert 2GB
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/;
Oct 30 '08 #2

Post your reply

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

Similar topics

12 posts views Thread by dan glenn | last post: by
5 posts views Thread by Mechphisto | last post: by
5 posts views Thread by Jonathan Daggar | last post: by
6 posts views Thread by Markus Ernst | last post: by
4 posts views Thread by tcfin | last post: by
16 posts views Thread by junky_fellow@yahoo.co.in | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.