{
    "mode": "perldoc",
    "parameter": "Devel::Peek",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Devel%3A%3APeek/json",
    "generated": "2026-06-13T21:15:32Z",
    "synopsis": "use Devel::Peek;\nDump( $a );\nDump( $a, 5 );\nDump( @a );\nDump( %h );\nDumpArray( 5, $a, $b, ... );\nmstat \"Point 5\";\nuse Devel::Peek ':opd=st';",
    "sections": {
        "NAME": {
            "content": "Devel::Peek - A data debugging tool for the XS programmer\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Devel::Peek;\nDump( $a );\nDump( $a, 5 );\nDump( @a );\nDump( %h );\nDumpArray( 5, $a, $b, ... );\nmstat \"Point 5\";\n\nuse Devel::Peek ':opd=st';\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Devel::Peek contains functions which allows raw Perl datatypes to be manipulated from a Perl\nscript. This is used by those who do XS programming to check that the data they are sending from\nC to Perl looks as they think it should look. The trick, then, is to know what the raw datatype\nis supposed to look like when it gets to Perl. This document offers some tips and hints to\ndescribe good and bad raw data.\n\nIt is very possible that this document will fall far short of being useful to the casual reader.\nThe reader is expected to understand the material in the first few sections of perlguts.\n\nDevel::Peek supplies a \"Dump()\" function which can dump a raw Perl datatype, and\n\"mstat(\"marker\")\" function to report on memory usage (if perl is compiled with corresponding\noption). The function DeadCode() provides statistics on the data \"frozen\" into inactive \"CV\".\nDevel::Peek also supplies \"SvREFCNT()\" which can query reference counts on SVs. This document\nwill take a passive, and safe, approach to data debugging and for that it will describe only the\n\"Dump()\" function.\n\nAll output is to STDERR.\n\nThe \"Dump()\" function takes one or two arguments: something to dump, and an optional limit for\nrecursion and array elements (default is 4). The first argument is evaluated in rvalue scalar\ncontext, with exceptions for @array and %hash, which dump the array or hash itself. So \"Dump\n@array\" works, as does \"Dump $foo\". And \"Dump pos\" will call \"pos\" in rvalue context, whereas\n\"Dump ${\\pos}\" will call it in lvalue context.\n\nFunction \"DumpArray()\" allows dumping of multiple values (useful when you need to analyze\nreturns of functions).\n\nThe global variable $Devel::Peek::pvlimit can be set to limit the number of character printed\nin various string values. Setting it to 0 means no limit.\n\nIf \"use Devel::Peek\" directive has a \":opd=FLAGS\" argument, this switches on debugging of opcode\ndispatch. \"FLAGS\" should be a combination of \"s\", \"t\", and \"P\" (see -D flags in perlrun).\n\n\":opd\" is a shortcut for \":opd=st\".\n",
            "subsections": [
                {
                    "name": "Runtime debugging",
                    "content": "\"CvGV($cv)\" return one of the globs associated to a subroutine reference $cv.\n"
                },
                {
                    "name": "debug_flags",
                    "content": "When called with a numeric argument, sets $^D to the corresponding value. When called with an\nargument of the form \"flags-flags\", set on/off bits of $^D corresponding to letters before/after\n\"-\". (The returned value is for $^D before the modification.)\n"
                },
                {
                    "name": "runops_debug",
                    "content": "with an argument, switches to debugging or non-debugging dispatcher depending on the argument\n(active for newly-entered subs/etc only). (The returned value is for the dispatcher before the\nmodification.)\n"
                },
                {
                    "name": "Memory footprint debugging",
                    "content": "When perl is compiled with support for memory footprint debugging (default with Perl's"
                },
                {
                    "name": "malloc",
                    "content": "Use mstat() function to emit a memory state statistic to the terminal. For more information on\nthe format of output of mstat() see \"Using $ENV{PERLDEBUGMSTATS}\" in perldebguts.\n\nThree additional functions allow access to this statistic from Perl. First, use\n\"mstatsfillhash(%hash)\" to get the information contained in the output of mstat() into %hash.\nThe field of this hash are\n\nminbucket nbuckets sbrkgood sbrkslack sbrkedremains sbrks\nstartslack topbucket topbucketev topbucketodd total totalchain\ntotalsbrk totfree\n\nTwo additional fields \"free\", \"used\" contain array references which provide per-bucket count of\nfree and used chunks. Two other fields \"memsize\", \"availablesize\" contain array references\nwhich provide the information about the allocated size and usable size of chunks in each bucket.\nAgain, see \"Using $ENV{PERLDEBUGMSTATS}\" in perldebguts for details.\n\nKeep in mind that only the first several \"odd-numbered\" buckets are used, so the information on\nsize of the \"odd-numbered\" buckets which are not used is probably meaningless.\n\nThe information in\n\nmemsize availablesize minbucket nbuckets\n\nis the property of a particular build of perl, and does not depend on the current process. If\nyou do not provide the optional argument to the functions mstatsfillhash(), fillmstats(),"
                },
                {
                    "name": "mstats2hash",
                    "content": "\"fillmstats($buf)\" is a much cheaper call (both speedwise and memory-wise) which collects the\nstatistic into $buf in machine-readable form. At a later moment you may need to call\n\"mstats2hash($buf, %hash)\" to use this information to fill %hash.\n\nAll three APIs \"fillmstats($buf)\", \"mstatsfillhash(%hash)\", and \"mstats2hash($buf, %hash)\" are\ndesigned to allocate no memory if used *the second time* on the same $buf and/or %hash.\n\nSo, if you want to collect memory info in a cycle, you may call\n\n$#buf = 999;\nfillmstats($) for @buf;\nmstatsfillhash(%report, 1);          # Static info too\n\nforeach (@buf) {\n# Do something...\nfillmstats $;                     # Collect statistic\n}\nforeach (@buf) {\nmstats2hash($, %report);           # Preserve static info\n# Do something with %report\n}\n"
                }
            ]
        },
        "EXAMPLES": {
            "content": "The following examples don't attempt to show everything as that would be a monumental task, and,\nfrankly, we don't want this manpage to be an internals document for Perl. The examples do\ndemonstrate some basics of the raw Perl datatypes, and should suffice to get most determined\npeople on their way. There are no guidewires or safety nets, nor blazed trails, so be prepared\nto travel alone from this point and on and, if at all possible, don't fall into the quicksand\n(it's bad for business).\n\nOh, one final bit of advice: take perlguts with you. When you return we expect to see it\nwell-thumbed.\n\nA simple scalar string\nLet's begin by looking a simple scalar which is holding a string.\n\nuse Devel::Peek;\n$a = 42; $a = \"hello\";\nDump $a;\n\nThe output:\n\nSV = PVIV(0xbc288) at 0xbe9a8\nREFCNT = 1\nFLAGS = (POK,pPOK)\nIV = 42\nPV = 0xb2048 \"hello\"\\0\nCUR = 5\nLEN = 8\n\nThis says $a is an SV, a scalar. The scalar type is a PVIV, which is capable of holding an\ninteger (IV) and/or a string (PV) value. The scalar's head is allocated at address 0xbe9a8,\nwhile the body is at 0xbc288. Its reference count is 1. It has the \"POK\" flag set, meaning its\ncurrent PV field is valid. Because POK is set we look at the PV item to see what is in the\nscalar. The \\0 at the end indicate that this PV is properly NUL-terminated. Note that the IV\nfield still contains its old numeric value, but because FLAGS doesn't have IOK set, we must\nignore the IV item. CUR indicates the number of characters in the PV. LEN indicates the number\nof bytes allocated for the PV (at least one more than CUR, because LEN includes an extra byte\nfor the end-of-string marker, then usually rounded up to some efficient allocation unit).\n\nA simple scalar number\nIf the scalar contains a number the raw SV will be leaner.\n\nuse Devel::Peek;\n$a = 42;\nDump $a;\n\nThe output:\n\nSV = IV(0xbc818) at 0xbe9a8\nREFCNT = 1\nFLAGS = (IOK,pIOK)\nIV = 42\n\nThis says $a is an SV, a scalar. The scalar is an IV, a number. Its reference count is 1. It has\nthe \"IOK\" flag set, meaning it is currently being evaluated as a number. Because IOK is set we\nlook at the IV item to see what is in the scalar.\n\nA simple scalar with an extra reference\nIf the scalar from the previous example had an extra reference:\n\nuse Devel::Peek;\n$a = 42;\n$b = \\$a;\nDump $a;\n\nThe output:\n\nSV = IV(0xbe860) at 0xbe9a8\nREFCNT = 2\nFLAGS = (IOK,pIOK)\nIV = 42\n\nNotice that this example differs from the previous example only in its reference count. Compare\nthis to the next example, where we dump $b instead of $a.\n\nA reference to a simple scalar\nThis shows what a reference looks like when it references a simple scalar.\n\nuse Devel::Peek;\n$a = 42;\n$b = \\$a;\nDump $b;\n\nThe output:\n\nSV = IV(0xf041c) at 0xbe9a0\nREFCNT = 1\nFLAGS = (ROK)\nRV = 0xbab08\nSV = IV(0xbe860) at 0xbe9a8\nREFCNT = 2\nFLAGS = (IOK,pIOK)\nIV = 42\n\nStarting from the top, this says $b is an SV. The scalar is an IV, which is capable of holding\nan integer or reference value. It has the \"ROK\" flag set, meaning it is a reference (rather than\nan integer or string). Notice that Dump follows the reference and shows us what $b was\nreferencing. We see the same $a that we found in the previous example.\n\nNote that the value of \"RV\" coincides with the numbers we see when we stringify $b. The\naddresses inside IV() are addresses of \"X*\" structures which hold the current state of an\n\"SV\". This address may change during lifetime of an SV.\n\nA reference to an array\nThis shows what a reference to an array looks like.\n\nuse Devel::Peek;\n$a = [42];\nDump $a;\n\nThe output:\n\nSV = IV(0xc85998) at 0xc859a8\nREFCNT = 1\nFLAGS = (ROK)\nRV = 0xc70de8\nSV = PVAV(0xc71e10) at 0xc70de8\nREFCNT = 1\nFLAGS = ()\nARRAY = 0xc7e820\nFILL = 0\nMAX = 0\nFLAGS = (REAL)\nElt No. 0\nSV = IV(0xc70f88) at 0xc70f98\nREFCNT = 1\nFLAGS = (IOK,pIOK)\nIV = 42\n\nThis says $a is a reference (ROK), which points to another SV which is a PVAV, an array. The\narray has one element, element zero, which is another SV. The field \"FILL\" above indicates the\nlast element in the array, similar to \"$#$a\".\n\nIf $a pointed to an array of two elements then we would see the following.\n\nuse Devel::Peek 'Dump';\n$a = [42,24];\nDump $a;\n\nThe output:\n\nSV = IV(0x158c998) at 0x158c9a8\nREFCNT = 1\nFLAGS = (ROK)\nRV = 0x1577de8\nSV = PVAV(0x1578e10) at 0x1577de8\nREFCNT = 1\nFLAGS = ()\nARRAY = 0x1585820\nFILL = 1\nMAX = 1\nFLAGS = (REAL)\nElt No. 0\nSV = IV(0x1577f88) at 0x1577f98\nREFCNT = 1\nFLAGS = (IOK,pIOK)\nIV = 42\nElt No. 1\nSV = IV(0x158be88) at 0x158be98\nREFCNT = 1\nFLAGS = (IOK,pIOK)\nIV = 24\n\nNote that \"Dump\" will not report *all* the elements in the array, only several first (depending\non how deep it already went into the report tree).\n\nA reference to a hash\nThe following shows the raw form of a reference to a hash.\n\nuse Devel::Peek;\n$a = {hello=>42};\nDump $a;\n\nThe output:\n\nSV = IV(0x55cb50b50fb0) at 0x55cb50b50fc0\nREFCNT = 1\nFLAGS = (ROK)\nRV = 0x55cb50b2b758\nSV = PVHV(0x55cb50b319c0) at 0x55cb50b2b758\nREFCNT = 1\nFLAGS = (SHAREKEYS)\nARRAY = 0x55cb50b941a0  (0:7, 1:1)\nhash quality = 100.0%\nKEYS = 1\nFILL = 1\nMAX = 7\nElt \"hello\" HASH = 0x3128ece4\nSV = IV(0x55cb50b464f8) at 0x55cb50b46508\nREFCNT = 1\nFLAGS = (IOK,pIOK)\nIV = 42\n\nThis shows $a is a reference pointing to an SV. That SV is a PVHV, a hash.\n\nThe \"quality\" of a hash is defined as the total number of comparisons needed to access every\nelement once, relative to the expected number needed for a random hash. The value can go over\n100%.\n\nThe total number of comparisons is equal to the sum of the squares of the number of entries in\neach bucket. For a random hash of \"<n\"> keys into \"<k\"> buckets, the expected value is:\n\nn + n(n-1)/2k\n",
            "subsections": [
                {
                    "name": "Dumping a large array or hash",
                    "content": "The \"Dump()\" function, by default, dumps up to 4 elements from a toplevel array or hash. This\nnumber can be increased by supplying a second argument to the function.\n\nuse Devel::Peek;\n$a = [10,11,12,13,14];\nDump $a;\n\nNotice that \"Dump()\" prints only elements 10 through 13 in the above code. The following code\nwill print all of the elements.\n\nuse Devel::Peek 'Dump';\n$a = [10,11,12,13,14];\nDump $a, 5;\n\nA reference to an SV which holds a C pointer\nThis is what you really need to know as an XS programmer, of course. When an XSUB returns a\npointer to a C structure that pointer is stored in an SV and a reference to that SV is placed on\nthe XSUB stack. So the output from an XSUB which uses something like the TPTROBJ map might look\nsomething like this:\n\nSV = IV(0xf381c) at 0xc859a8\nREFCNT = 1\nFLAGS = (ROK)\nRV = 0xb8ad8\nSV = PVMG(0xbb3c8) at 0xc859a0\nREFCNT = 1\nFLAGS = (OBJECT,IOK,pIOK)\nIV = 729160\nNV = 0\nPV = 0\nSTASH = 0xc1d10       \"CookBookB::Opaque\"\n\nThis shows that we have an SV which is a reference, which points at another SV. In this case\nthat second SV is a PVMG, a blessed scalar. Because it is blessed it has the \"OBJECT\" flag set.\nNote that an SV which holds a C pointer also has the \"IOK\" flag set. The \"STASH\" is set to the\npackage name which this SV was blessed into.\n\nThe output from an XSUB which uses something like the TPTRREF map, which doesn't bless the\nobject, might look something like this:\n\nSV = IV(0xf381c) at 0xc859a8\nREFCNT = 1\nFLAGS = (ROK)\nRV = 0xb8ad8\nSV = PVMG(0xbb3c8) at 0xc859a0\nREFCNT = 1\nFLAGS = (IOK,pIOK)\nIV = 729160\nNV = 0\nPV = 0\n\nA reference to a subroutine\nLooks like this:\n\nSV = IV(0x24d2dd8) at 0x24d2de8\nREFCNT = 1\nFLAGS = (TEMP,ROK)\nRV = 0x24e79d8\nSV = PVCV(0x24e5798) at 0x24e79d8\nREFCNT = 2\nFLAGS = ()\nCOMPSTASH = 0x22c9c50      \"main\"\nSTART = 0x22eed60 ===> 0\nROOT = 0x22ee490\nGVGV::GV = 0x22de9d8        \"MY\" :: \"toptargets\"\nFILE = \"(eval 5)\"\nDEPTH = 0\nFLAGS = 0x0\nOUTSIDESEQ = 93\nPADLIST = 0x22e9ed8\nPADNAME = 0x22e9ec0(0x22eed00) PAD = 0x22e9ea8(0x22eecd0)\nOUTSIDE = 0x22c9fb0 (MAIN)\n\nThis shows that\n\n*   the subroutine is not an XSUB (since \"START\" and \"ROOT\" are non-zero, and \"XSUB\" is not\nlisted, and is thus null);\n\n*   that it was compiled in the package \"main\";\n\n*   under the name \"MY::toptargets\";\n\n*   inside a 5th eval in the program;\n\n*   it is not currently executed (because \"DEPTH\" is 0);\n\n*   it has no prototype (\"PROTOTYPE\" field is missing).\n"
                }
            ]
        },
        "EXPORTS": {
            "content": "\"Dump\", \"mstat\", \"DeadCode\", \"DumpArray\", \"DumpWithOP\" and \"DumpProg\", \"fillmstats\",\n\"mstatsfillhash\", \"mstats2hash\" by default. Additionally available \"SvREFCNT\", \"SvREFCNTinc\"\nand \"SvREFCNTdec\".\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Readers have been known to skip important parts of perlguts, causing much frustration for all.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Ilya Zakharevich ilya@math.ohio-state.edu\n\nCopyright (c) 1995-98 Ilya Zakharevich. All rights reserved. This program is free software; you\ncan redistribute it and/or modify it under the same terms as Perl itself.\n\nAuthor of this software makes no claim whatsoever about suitability, reliability, edability,\neditability or usability of this product, and should not be kept liable for any damage resulting\nfrom the use of it. If you can use it, you are in luck, if not, I should not be kept\nresponsible. Keep a handy copy of your backup tape at hand.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "perlguts, and perlguts, again.\n",
            "subsections": []
        }
    },
    "summary": "Devel::Peek - A data debugging tool for the XS programmer",
    "flags": [],
    "examples": [
        "The following examples don't attempt to show everything as that would be a monumental task, and,",
        "frankly, we don't want this manpage to be an internals document for Perl. The examples do",
        "demonstrate some basics of the raw Perl datatypes, and should suffice to get most determined",
        "people on their way. There are no guidewires or safety nets, nor blazed trails, so be prepared",
        "to travel alone from this point and on and, if at all possible, don't fall into the quicksand",
        "(it's bad for business).",
        "Oh, one final bit of advice: take perlguts with you. When you return we expect to see it",
        "well-thumbed.",
        "A simple scalar string",
        "Let's begin by looking a simple scalar which is holding a string.",
        "use Devel::Peek;",
        "$a = 42; $a = \"hello\";",
        "Dump $a;",
        "The output:",
        "SV = PVIV(0xbc288) at 0xbe9a8",
        "REFCNT = 1",
        "FLAGS = (POK,pPOK)",
        "IV = 42",
        "PV = 0xb2048 \"hello\"\\0",
        "CUR = 5",
        "LEN = 8",
        "This says $a is an SV, a scalar. The scalar type is a PVIV, which is capable of holding an",
        "integer (IV) and/or a string (PV) value. The scalar's head is allocated at address 0xbe9a8,",
        "while the body is at 0xbc288. Its reference count is 1. It has the \"POK\" flag set, meaning its",
        "current PV field is valid. Because POK is set we look at the PV item to see what is in the",
        "scalar. The \\0 at the end indicate that this PV is properly NUL-terminated. Note that the IV",
        "field still contains its old numeric value, but because FLAGS doesn't have IOK set, we must",
        "ignore the IV item. CUR indicates the number of characters in the PV. LEN indicates the number",
        "of bytes allocated for the PV (at least one more than CUR, because LEN includes an extra byte",
        "for the end-of-string marker, then usually rounded up to some efficient allocation unit).",
        "A simple scalar number",
        "If the scalar contains a number the raw SV will be leaner.",
        "use Devel::Peek;",
        "$a = 42;",
        "Dump $a;",
        "The output:",
        "SV = IV(0xbc818) at 0xbe9a8",
        "REFCNT = 1",
        "FLAGS = (IOK,pIOK)",
        "IV = 42",
        "This says $a is an SV, a scalar. The scalar is an IV, a number. Its reference count is 1. It has",
        "the \"IOK\" flag set, meaning it is currently being evaluated as a number. Because IOK is set we",
        "look at the IV item to see what is in the scalar.",
        "A simple scalar with an extra reference",
        "If the scalar from the previous example had an extra reference:",
        "use Devel::Peek;",
        "$a = 42;",
        "$b = \\$a;",
        "Dump $a;",
        "The output:",
        "SV = IV(0xbe860) at 0xbe9a8",
        "REFCNT = 2",
        "FLAGS = (IOK,pIOK)",
        "IV = 42",
        "Notice that this example differs from the previous example only in its reference count. Compare",
        "this to the next example, where we dump $b instead of $a.",
        "A reference to a simple scalar",
        "This shows what a reference looks like when it references a simple scalar.",
        "use Devel::Peek;",
        "$a = 42;",
        "$b = \\$a;",
        "Dump $b;",
        "The output:",
        "SV = IV(0xf041c) at 0xbe9a0",
        "REFCNT = 1",
        "FLAGS = (ROK)",
        "RV = 0xbab08",
        "SV = IV(0xbe860) at 0xbe9a8",
        "REFCNT = 2",
        "FLAGS = (IOK,pIOK)",
        "IV = 42",
        "Starting from the top, this says $b is an SV. The scalar is an IV, which is capable of holding",
        "an integer or reference value. It has the \"ROK\" flag set, meaning it is a reference (rather than",
        "an integer or string). Notice that Dump follows the reference and shows us what $b was",
        "referencing. We see the same $a that we found in the previous example.",
        "Note that the value of \"RV\" coincides with the numbers we see when we stringify $b. The",
        "addresses inside IV() are addresses of \"X*\" structures which hold the current state of an",
        "\"SV\". This address may change during lifetime of an SV.",
        "A reference to an array",
        "This shows what a reference to an array looks like.",
        "use Devel::Peek;",
        "$a = [42];",
        "Dump $a;",
        "The output:",
        "SV = IV(0xc85998) at 0xc859a8",
        "REFCNT = 1",
        "FLAGS = (ROK)",
        "RV = 0xc70de8",
        "SV = PVAV(0xc71e10) at 0xc70de8",
        "REFCNT = 1",
        "FLAGS = ()",
        "ARRAY = 0xc7e820",
        "FILL = 0",
        "MAX = 0",
        "FLAGS = (REAL)",
        "Elt No. 0",
        "SV = IV(0xc70f88) at 0xc70f98",
        "REFCNT = 1",
        "FLAGS = (IOK,pIOK)",
        "IV = 42",
        "This says $a is a reference (ROK), which points to another SV which is a PVAV, an array. The",
        "array has one element, element zero, which is another SV. The field \"FILL\" above indicates the",
        "last element in the array, similar to \"$#$a\".",
        "If $a pointed to an array of two elements then we would see the following.",
        "use Devel::Peek 'Dump';",
        "$a = [42,24];",
        "Dump $a;",
        "The output:",
        "SV = IV(0x158c998) at 0x158c9a8",
        "REFCNT = 1",
        "FLAGS = (ROK)",
        "RV = 0x1577de8",
        "SV = PVAV(0x1578e10) at 0x1577de8",
        "REFCNT = 1",
        "FLAGS = ()",
        "ARRAY = 0x1585820",
        "FILL = 1",
        "MAX = 1",
        "FLAGS = (REAL)",
        "Elt No. 0",
        "SV = IV(0x1577f88) at 0x1577f98",
        "REFCNT = 1",
        "FLAGS = (IOK,pIOK)",
        "IV = 42",
        "Elt No. 1",
        "SV = IV(0x158be88) at 0x158be98",
        "REFCNT = 1",
        "FLAGS = (IOK,pIOK)",
        "IV = 24",
        "Note that \"Dump\" will not report *all* the elements in the array, only several first (depending",
        "on how deep it already went into the report tree).",
        "A reference to a hash",
        "The following shows the raw form of a reference to a hash.",
        "use Devel::Peek;",
        "$a = {hello=>42};",
        "Dump $a;",
        "The output:",
        "SV = IV(0x55cb50b50fb0) at 0x55cb50b50fc0",
        "REFCNT = 1",
        "FLAGS = (ROK)",
        "RV = 0x55cb50b2b758",
        "SV = PVHV(0x55cb50b319c0) at 0x55cb50b2b758",
        "REFCNT = 1",
        "FLAGS = (SHAREKEYS)",
        "ARRAY = 0x55cb50b941a0  (0:7, 1:1)",
        "hash quality = 100.0%",
        "KEYS = 1",
        "FILL = 1",
        "MAX = 7",
        "Elt \"hello\" HASH = 0x3128ece4",
        "SV = IV(0x55cb50b464f8) at 0x55cb50b46508",
        "REFCNT = 1",
        "FLAGS = (IOK,pIOK)",
        "IV = 42",
        "This shows $a is a reference pointing to an SV. That SV is a PVHV, a hash.",
        "The \"quality\" of a hash is defined as the total number of comparisons needed to access every",
        "element once, relative to the expected number needed for a random hash. The value can go over",
        "100%.",
        "The total number of comparisons is equal to the sum of the squares of the number of entries in",
        "each bucket. For a random hash of \"<n\"> keys into \"<k\"> buckets, the expected value is:",
        "n + n(n-1)/2k",
        "The \"Dump()\" function, by default, dumps up to 4 elements from a toplevel array or hash. This",
        "number can be increased by supplying a second argument to the function.",
        "use Devel::Peek;",
        "$a = [10,11,12,13,14];",
        "Dump $a;",
        "Notice that \"Dump()\" prints only elements 10 through 13 in the above code. The following code",
        "will print all of the elements.",
        "use Devel::Peek 'Dump';",
        "$a = [10,11,12,13,14];",
        "Dump $a, 5;",
        "A reference to an SV which holds a C pointer",
        "This is what you really need to know as an XS programmer, of course. When an XSUB returns a",
        "pointer to a C structure that pointer is stored in an SV and a reference to that SV is placed on",
        "the XSUB stack. So the output from an XSUB which uses something like the TPTROBJ map might look",
        "something like this:",
        "SV = IV(0xf381c) at 0xc859a8",
        "REFCNT = 1",
        "FLAGS = (ROK)",
        "RV = 0xb8ad8",
        "SV = PVMG(0xbb3c8) at 0xc859a0",
        "REFCNT = 1",
        "FLAGS = (OBJECT,IOK,pIOK)",
        "IV = 729160",
        "NV = 0",
        "PV = 0",
        "STASH = 0xc1d10       \"CookBookB::Opaque\"",
        "This shows that we have an SV which is a reference, which points at another SV. In this case",
        "that second SV is a PVMG, a blessed scalar. Because it is blessed it has the \"OBJECT\" flag set.",
        "Note that an SV which holds a C pointer also has the \"IOK\" flag set. The \"STASH\" is set to the",
        "package name which this SV was blessed into.",
        "The output from an XSUB which uses something like the TPTRREF map, which doesn't bless the",
        "object, might look something like this:",
        "SV = IV(0xf381c) at 0xc859a8",
        "REFCNT = 1",
        "FLAGS = (ROK)",
        "RV = 0xb8ad8",
        "SV = PVMG(0xbb3c8) at 0xc859a0",
        "REFCNT = 1",
        "FLAGS = (IOK,pIOK)",
        "IV = 729160",
        "NV = 0",
        "PV = 0",
        "A reference to a subroutine",
        "Looks like this:",
        "SV = IV(0x24d2dd8) at 0x24d2de8",
        "REFCNT = 1",
        "FLAGS = (TEMP,ROK)",
        "RV = 0x24e79d8",
        "SV = PVCV(0x24e5798) at 0x24e79d8",
        "REFCNT = 2",
        "FLAGS = ()",
        "COMPSTASH = 0x22c9c50      \"main\"",
        "START = 0x22eed60 ===> 0",
        "ROOT = 0x22ee490",
        "GVGV::GV = 0x22de9d8        \"MY\" :: \"toptargets\"",
        "FILE = \"(eval 5)\"",
        "DEPTH = 0",
        "FLAGS = 0x0",
        "OUTSIDESEQ = 93",
        "PADLIST = 0x22e9ed8",
        "PADNAME = 0x22e9ec0(0x22eed00) PAD = 0x22e9ea8(0x22eecd0)",
        "OUTSIDE = 0x22c9fb0 (MAIN)",
        "This shows that",
        "*   the subroutine is not an XSUB (since \"START\" and \"ROOT\" are non-zero, and \"XSUB\" is not",
        "listed, and is thus null);",
        "*   that it was compiled in the package \"main\";",
        "*   under the name \"MY::toptargets\";",
        "*   inside a 5th eval in the program;",
        "*   it is not currently executed (because \"DEPTH\" is 0);",
        "*   it has no prototype (\"PROTOTYPE\" field is missing)."
    ],
    "see_also": []
}