in reply to Bare Subnames
in thread is this correct?

I don't think that require or eval will cut it.

What is going on is that Perl will not complain if it has already compiled the fact that you have subroutines when you hit the bareword. Since strict creates a compile time complaint, it will fail without ever paying any attention to require or eval. (Unless, of course they are in a BEGIN block.)

This actually gets at some important points. The same behaviour that you see with strict comes up again with prototypes. Here is the underlying cause.

When perl (not a typo, the language is Perl, the interpreter is perl) sees your script it fundamentally has 2 different things that it does. The first is it compiles code to an internal representation, the second is that it runs that internal representation. These take place in separate passes. However some things will cause it to switch from one to the other.

While compiling if Perl sees certain things, for instance a complete BEGIN block or use, it will switch out of compiling your script to go do something else and then return to your script when it is done that. Conversely while running if your program encounters other things, for instance require and eval, it may have to go back to compiling more code.

Now the (obvious) rule is that at no point can you take into account code that you have not (yet) compiled. By the time your main script gets around to running, most stuff has compiled, and it just works. But if the code affects compilation in some way (eg telling Perl that a sub really exists, or declaring a prototype for a subroutine) then it cannot take effect until *after* Perl has seen that text.

Does that make sense?