in reply to Restoring the magic to the _ filehandle in Perl 5.8.9
As you've stated, if you delay the execution of the code, there's no problem. I presume the reason you're using BEGIN is that the code inside will end up in a module. But you're not out of luck. Execution of INIT blocks are delayed until the main script has finished compiling.
If you change
toBEGIN { *::_ = sub { # Shout to be understood return uc($_[0]); }; }
BEGIN { INIT { *::_ = sub { # Shout to be understood return uc($_[0]); }; } }
then the parser won't think the "_" in "-l _" is a function call since there's no function called "_" yet.
Caveat: Modules loaded after the script has been compiled...
In Section
Seekers of Perl Wisdom