in reply to Regex Confusion

I also want to eliminate all newline characters from a string

use chomp use the solution from toolic below. (I should have read the text more carefully ... sorry)

Replies are listed 'Best First'.
Re^2: Regex Confusion
by toolic (Bishop) on Feb 10, 2010 at 14:45 UTC
    chomp does not remove all newlines from a string, only the last newline. This removes all newlines:
    $string =~ s/\n//g;
    More precisely:
    This safer version of "chop" removes any trailing string that corresponds to the current value of $/ (also known as $INPUT_RECORD_SEPARATOR in the English module).
      Thank you, I realy should have known that, but now I should never forget.