Help for this page

Select Code to Download


  1. or download this
    local $/ = "\r\n";
    while (<DATA>) {
       chomp $_;
       print STDERR "'$_'\n";
    }
    
  2. or download this
    while (<DATA>) {
       s/\r[\n]*/\n/gm;  # now, an \r (Mac) or \r\n (Win) becomes \n (UNIX
    +)
       chomp $_;
       print STDERR "'$_'\n";
    }
    
  3. or download this
       s/\r[\n]*//gm;
    
  4. or download this
    open FH, '<', $file or die "Can't read '$file': $!";
    # find out what kind of line endings we have
    ...
       print STDERR "'$_'\n";
    }
    close FH;