Perl was supposed to be about the freedom to do things 20-100 different ways...
If you throw a random mess of nonsense at the compiler and expect it to do what you think you mean, you're going to spend a lot of time surprised at the results.
Um... there are a few things your example doesn't do nor solve, yet proves.
Nonsense. What Corion wrote is correct.
... standard methods others suggest don't work...
Utter nonsense. Code I wrote that's been run countless millions of times would not work if that were true, and millions of successful test reports from CPAN Testers alone demonstrates that that feature works as it has for years.