in reply to Have I found a bug in Perl?

Yes, it's a bug. I reported this a long time ago and was told it was a side-effect of some optimization. It may be fixed by now, but I haven't tried on the latest releases.