{
    "content": [
        {
            "type": "text",
            "text": "# CORE (man)\n\n## NAME\n\nCORE - Namespace for Perl's core routines\n\n## SYNOPSIS\n\nBEGIN {\n*CORE::GLOBAL::hex = sub { 1; };\n}\nprint hex(\"0x50\"),\"\\n\";                     # prints 1\nprint CORE::hex(\"0x50\"),\"\\n\";               # prints 80\nCORE::say \"yes\";                            # prints yes\nBEGIN { *shove = \\&CORE::push; }\nshove @array, 1,2,3;                        # pushes on to @array\n\n## DESCRIPTION\n\nThe \"CORE\" namespace gives access to the original built-in functions of Perl.  The \"CORE\"\npackage is built into Perl, and therefore you do not need to use or require a hypothetical\n\"CORE\" module prior to accessing routines in this namespace.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OVERRIDING CORE FUNCTIONS**\n- **AUTHOR**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "CORE",
        "section": "",
        "mode": "man",
        "summary": "CORE - Namespace for Perl's core routines",
        "synopsis": "BEGIN {\n*CORE::GLOBAL::hex = sub { 1; };\n}\nprint hex(\"0x50\"),\"\\n\";                     # prints 1\nprint CORE::hex(\"0x50\"),\"\\n\";               # prints 80\nCORE::say \"yes\";                            # prints yes\nBEGIN { *shove = \\&CORE::push; }\nshove @array, 1,2,3;                        # pushes on to @array",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "OVERRIDING CORE FUNCTIONS",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "CORE - Namespace for Perl's core routines\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "BEGIN {\n*CORE::GLOBAL::hex = sub { 1; };\n}\n\nprint hex(\"0x50\"),\"\\n\";                     # prints 1\nprint CORE::hex(\"0x50\"),\"\\n\";               # prints 80\nCORE::say \"yes\";                            # prints yes\n\nBEGIN { *shove = \\&CORE::push; }\nshove @array, 1,2,3;                        # pushes on to @array\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The \"CORE\" namespace gives access to the original built-in functions of Perl.  The \"CORE\"\npackage is built into Perl, and therefore you do not need to use or require a hypothetical\n\"CORE\" module prior to accessing routines in this namespace.\n\nA list of the built-in functions in Perl can be found in perlfunc.\n\nFor all Perl keywords, a \"CORE::\" prefix will force the built-in function to be used, even if\nit has been overridden or would normally require the feature pragma.  Despite appearances,\nthis has nothing to do with the CORE package, but is part of Perl's syntax.\n\nFor many Perl functions, the CORE package contains real subroutines.  This feature is new in\nPerl 5.16.  You can take references to these and make aliases.  However, some can only be\ncalled as barewords; i.e., you cannot use ampersand syntax (&foo) or call them through\nreferences.  See the \"shove\" example above.  These subroutines exist for all keywords except\nthe following:\n\n\"DATA\", \"END\", \"and\", \"cmp\", \"default\", \"do\", \"dump\", \"else\", \"elsif\", \"eq\", \"eval\",\n\"for\", \"foreach\", \"format\", \"ge\", \"given\", \"goto\", \"grep\", \"gt\", \"if\", \"last\", \"le\", \"local\",\n\"lt\", \"m\", \"map\", \"my\", \"ne\", \"next\", \"no\", \"or\", \"our\", \"package\", \"print\", \"printf\", \"q\",\n\"qq\", \"qr\", \"qw\", \"qx\", \"redo\", \"require\", \"return\", \"s\", \"say\", \"sort\", \"state\", \"sub\",\n\"tr\", \"unless\", \"until\", \"use\", \"when\", \"while\", \"x\", \"xor\", \"y\"\n\nCalling with ampersand syntax and through references does not work for the following\nfunctions, as they have special syntax that cannot always be translated into a simple list\n(e.g., \"eof\" vs \"eof()\"):\n\n\"chdir\", \"chomp\", \"chop\", \"defined\", \"delete\", \"eof\", \"exec\", \"exists\", \"lstat\", \"split\",\n\"stat\", \"system\", \"truncate\", \"unlink\"\n",
                "subsections": []
            },
            "OVERRIDING CORE FUNCTIONS": {
                "content": "To override a Perl built-in routine with your own version, you need to import it at compile-\ntime.  This can be conveniently achieved with the \"subs\" pragma.  This will affect only the\npackage in which you've imported the said subroutine:\n\nuse subs 'chdir';\nsub chdir { ... }\nchdir $somewhere;\n\nTo override a built-in globally (that is, in all namespaces), you need to import your\nfunction into the \"CORE::GLOBAL\" pseudo-namespace at compile time:\n\nBEGIN {\n*CORE::GLOBAL::hex = sub {\n# ... your code here\n};\n}\n\nThe new routine will be called whenever a built-in function is called without a qualifying\npackage:\n\nprint hex(\"0x50\"),\"\\n\";                     # prints 1\n\nIn both cases, if you want access to the original, unaltered routine, use the \"CORE::\"\nprefix:\n\nprint CORE::hex(\"0x50\"),\"\\n\";               # prints 80\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "This documentation provided by Tels <nospam-abuse@bloodgate.com> 2007.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "perlsub, perlfunc.\n\n\n\nperl v5.34.0                                 2025-07-25                                  CORE(3perl)",
                "subsections": []
            }
        }
    }
}