#!/usr/bin/perl use strict; use warnings; my $filename = shift; {    local $/ = LineSeparator($filename);    # mach was mit der Datei } exit 0; ############################################################ sub LineSeparator {    my ($file) = @_;    open (my $infile_h, '<', $file) or die "could not open '$file' for reading: $!";    binmode $infile_h;    my $eol = '';    my $format = 'unknown';    while (defined (my $chr = ord getc($infile_h))) {        if ($chr == 0x0D) {            $chr = ord getc($infile_h);            if ($chr == 0x0A) {                $format = 'DOS';                $eol = "\x0D\x0A";            } else {                $format = 'MacOS 9 or earlier';                $eol = "\x0D";            }            last;        } elsif ($chr == 0x0A) {            $format = 'UNIX';            $eol = "\x0A";            last;        }    }    close $infile_h;    print STDERR "Line terminator format: $format\n";    return $eol; }