Quotemy $line = "irgendwas \$pff \$pff_sum irgendwas "; my $skalar = '\$pff'; my $new_name = "ABCDEFG"; if ($line =~ s/$skalar\s/\$$new_name/g) { print "$line" }