Perl 5 had compile-time execution forever. And this feature is used in everyday's code as that feature is at the core of the implementation of exporting symbols from a module into its importer (See module Exporter).
Example: the BEGIN block is executed during the compile phase as the parser encounters it. The code injected in BEGIN blocks can affect how the rest of the file is parsed.
$ perl -E 'exit; BEGIN { say "Hello" }'
Hello
"perl -c" stops the program after compile, but before execution. In the following code the BEGIN block runs, but not "exit 1".
$ perl -c -E 'exit 1; BEGIN { say "Hello" }'; echo $?
Hello
-e syntax OK
0
Example: the BEGIN block is executed during the compile phase as the parser encounters it. The code injected in BEGIN blocks can affect how the rest of the file is parsed.
"perl -c" stops the program after compile, but before execution. In the following code the BEGIN block runs, but not "exit 1". More info:* https://perldoc.perl.org/perlmod#BEGIN,-UNITCHECK,-CHECK,-IN...
* https://perldoc.perl.org/perlfunc#use-Module-VERSION-LIST