smatch in your face

gabor on 2004-02-07T09:32:41

What will this snippet print ?

$s = "apple";
$rep = "banana";
while ($s =~ s/a/$rep/) {}
print $s;

 

 

 

Yes, this is nice infinate loop that was biting me for some 3 days. It was hidden somewhere in my code and was somewhat more complicated and I had good reasons to think that the problem is somewhere else but hey this is such a stupid bug.