Help for this page

Select Code to Download


  1. or download this
      sub remove_trailing_newline {
        $_[0] =~ s/[\r\n]+\Z//;
      }
    
  2. or download this
      if ( m/(\r\n|\n\r|\r|\n)$1/ ) {
        # two newlines in a row!
      }