use Data::Dumper; $foo = "bla\n"; $foo =~ s/.$//; warn Dumper $foo; # falsches Zeichen entfernt $foo = "bla\n"; $foo =~ s/.\z//s; warn Dumper $foo; # ah!