sub my_die($$$$) {
my ($msg,$file,$line,$exitcode) = @_;
if($msg =~ /\n$/s) {
print STDERR $msg;
}
else {
print STDERR "$msg at $file line $line\n";
}exit($exitcode);
}open DATEI,$pfad or my_die("Fehler beim oeffnen der Datei: $!\n",__FILE__,__LINE__,5);
HI erstmal thx für die alternative.
Was ich nicht ganz verstehe ist das "if($msg =~ /\n$/s)".
Warum machst du das ?
cya
SI