|Perl Monk, Perl Meditation|
Re: Functions in substitutions (s///) and Perl 5.8.by v_thunder (Scribe)
|on Oct 25, 2002 at 17:13 UTC||Need Help??|
After some testing, I am even more baffled than before. After attempting to create some small test cases, I'm sure there is a perl bug lurking here. Here are our (teichman's and my) findings:
This code will break:
Note the use of $_ in the helper function. Changing this to use another variable makes it all work as expected, as teichman said.
Strangely, however, taking out the pwd substitution (i.e., commenting out lines 15 and 16) seems to stop it from crashing as well, but only in this test case. I haven't been able to reproduce the exact behavior we see in our program yet.
This is being tested on Red Hat Linux 8.0 and SuSE Linux 8.1, both of which come with perl 5.8.0 (+/- a few patches of their own--which I believe are all unrelated to this).
Thanks for the useful tips!