$zahl =~ s/\G((?:^-)?\d{1,3}) (?= (?:\d\d\d)+ (?!\d) ) /$1\./gx;