$/ = "\r\n"; fuer sowas zu verwenden ist gefaehrlich, weil \n je nach OS einen unterschiedlichen wert (naemlich den des OS) annimmt; besser murphy's weg waehlen, oder die einkommende Datei parsen und hoffen, dass es keine binaere Datei ist, z.B. auf die schnelle:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
my (@newLine) = &AnalyzeFileEol($infile);
my $newLine = join("", map { chr(hex($_)) } @newline;
local $/ = $newLine;
# ------------------------------------------------------------
sub AnalyzeFileEol {
my ($file) = shift;
my $eol = chr(10);
unless (open (FH, "<", $file)) {
die "Error: couldn't read file '$file': $!\n";
} # unless
my @chars = ();
while (defined (my $chr = getc(FH))) {
my $hex = sprintf("%02X", ord($chr));
if ($hex eq '0D') {
my $next = sprintf("%02X", ord(getc(FH)));
if ($next eq '0A') { close (FH);
print "Newline format: Dos: $hex $next\n";
return ($hex,$next);
} # if
else { close (FH);
print "Newline format: Mac: $hex\n";
return ($hex);
} # else
} # if
elsif ($hex eq '0A') { close (FH);
print "Newline format: Unix: $hex\n";
return ($hex);
} # elsif
} # while
die "Error: couldn't find out file format\n";
close (FH);
return;
} # AnalyzeFile
# ------------------------------------------------------------