in reply to CORE::GLOBAL magic?

Here is some speculation:
$ perl -e '$x=\&fff;print $x->(2)' Undefined subroutine &main::fff called at -e line 1.
Looks like when you reference \&<Something>, it pre-declares a coderef/subref named <Something>

However, since the Name <Something> is declared without any content, it will complain when called.

If you happen to provide the content of the name <Something>, it works:

$ perl -e '$x=\&fff; sub fff{44};print $x->(2)' 44

                Memory fault   --   brain fried

Replies are listed 'Best First'.
Re^2: CORE::GLOBAL magic?
by Anonymous Monk on Jun 02, 2018 at 12:49 UTC
    I believe that it is close to the notion of "auto-vivification." An object is created within the interpreter to reflect the fact that you have referred-to this thing, and you see the (dummy) object that it made, but it has no actual definition and therefore no content. CORE::GLOBAL like all of CORE is a pseudo-namespace that exists because a namespace is needed not because it is actually real in the sense of other namespaces which appear in source code.
      Yes auto-vivification is close, the analogy becomes clearer since there is a hash like syntax to access the CODE slot of a typeglob. (like *CORE::sleep{CODE} )

      anyway the important question is to know if a real coderef exists.

      That's why you can check this with exists &Func; (sic)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery