Help for this page

Select Code to Download


  1. or download this
         my $s = "line1\r\nline2\r\nline3\r\n";
         print $s;
         $s =~ s/[\n\r]//g;
         print $s;
    
  2. or download this
         line1
         line2
         line3
         line1line2line3
    
  3. or download this
       /s simply allows . to match end-of-line chars 
           anywhere in the string (if needed)
       /m simply allows ^ and $ to match begin/end
    ...
       \r will both be found (if present) without
           resorting to /s or /m