Removing line break character and space from form data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mccalla
    New Member
    • Jan 2008
    • 4

    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,
    mccalla
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

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

    Code:
    $message =~ s/\n/[n]/;
    $message =~ s/\n//g;
    $message =~ s/\[n\]/\n/;

    Comment

    Working...