Perl just keeps getting better and better. Consider the following simple code:
#!/usr/bin/perl -w
$foo = "fooSTRIP";
$foo =~ s/STRIP//e;
print $foo
In Perl 5.6 this prints foo as expected. In Perl 5.8 (Debian 5.8.0-17) this prints foofooSTRIP.

Huh? My friends who like Perl claim that what's going on is that Perl is evaluating the right part of the s/STRIP//e, which is empty, as a Perl expression. And apparently in Perl 5.8 this empty expression doesn't evaluate to, say, an empty string. No, it evaluates to some previous expression's value.

The lack of a warning may be a bug. My fear is some Perlmonger decided that the empty expression evaluating to something non-empty is a feature.

PS - yes, I know the /e is unnecessary here and removing it fixes my problem.

  2003-06-03 02:51 Z