{
    "content": [
        {
            "type": "text",
            "text": "# Tie::RefHash (perldoc)\n\n**Summary:** Tie::RefHash - Use references as hash keys\n\n**Synopsis:** require 5.004;\nuse Tie::RefHash;\ntie HASHVARIABLE, 'Tie::RefHash', LIST;\ntie HASHVARIABLE, 'Tie::RefHash::Nestable', LIST;\nuntie HASHVARIABLE;\n\n## Examples\n\n- `use Tie::RefHash;`\n- `tie %h, 'Tie::RefHash';`\n- `$a = [];`\n- `$b = {};`\n- `$c = \\*main;`\n- `$d = \\\"gunk\";`\n- `$e = sub { 'foo' };`\n- `%h = ($a => 1, $b => 2, $c => 3, $d => 4, $e => 5);`\n- `$a->[0] = 'foo';`\n- `$b->{foo} = 'bar';`\n- `for (keys %h) {`\n- `print ref($), \"\\n\";`\n- `tie %h, 'Tie::RefHash::Nestable';`\n- `$h{$a}->{$b} = 1;`\n- `for (keys %h, keys %{$h{$a}}) {`\n- `print ref($), \"\\n\";`\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **VERSION** (2 lines)\n- **SYNOPSIS** (7 lines)\n- **DESCRIPTION** (6 lines) — 1 subsections\n  - perlfunc (4 lines)\n- **EXAMPLE** (20 lines)\n- **THREAD SUPPORT** (2 lines)\n- **STORABLE SUPPORT** (3 lines)\n- **SEE ALSO** (1 lines) — 1 subsections\n  - perl (1 lines)\n- **SUPPORT** (4 lines)\n- **AUTHORS** (4 lines)\n- **CONTRIBUTORS** (8 lines)\n- **COPYRIGHT AND LICENCE** (5 lines)\n\n## Full Content\n\n### NAME\n\nTie::RefHash - Use references as hash keys\n\n### VERSION\n\nversion 1.40\n\n### SYNOPSIS\n\nrequire 5.004;\nuse Tie::RefHash;\ntie HASHVARIABLE, 'Tie::RefHash', LIST;\ntie HASHVARIABLE, 'Tie::RefHash::Nestable', LIST;\n\nuntie HASHVARIABLE;\n\n### DESCRIPTION\n\nThis module provides the ability to use references as hash keys if you first \"tie\" the hash\nvariable to this module. Normally, only the keys of the tied hash itself are preserved as\nreferences; to use references as keys in hashes-of-hashes, use Tie::RefHash::Nestable, included\nas part of Tie::RefHash.\n\nIt is implemented using the standard perl TIEHASH interface. Please see the \"tie\" entry in\n\n#### perlfunc\n\nThe Nestable version works by looking for hash references being stored and converting them to\ntied hashes so that they too can have references as keys. This will happen without warning\nwhenever you store a reference to one of your own hashes in the tied hash.\n\n### EXAMPLE\n\nuse Tie::RefHash;\ntie %h, 'Tie::RefHash';\n$a = [];\n$b = {};\n$c = \\*main;\n$d = \\\"gunk\";\n$e = sub { 'foo' };\n%h = ($a => 1, $b => 2, $c => 3, $d => 4, $e => 5);\n$a->[0] = 'foo';\n$b->{foo} = 'bar';\nfor (keys %h) {\nprint ref($), \"\\n\";\n}\n\ntie %h, 'Tie::RefHash::Nestable';\n$h{$a}->{$b} = 1;\nfor (keys %h, keys %{$h{$a}}) {\nprint ref($), \"\\n\";\n}\n\n### THREAD SUPPORT\n\nTie::RefHash fully supports threading using the \"CLONE\" method.\n\n### STORABLE SUPPORT\n\nStorable hooks are provided for semantically correct serialization and cloning of tied\nrefhashes.\n\n### SEE ALSO\n\n#### perl\n\n### SUPPORT\n\nBugs may be submitted through the RT bug tracker\n<https://rt.cpan.org/Public/Dist/Display.html?Name=Tie-RefHash> (or bug-Tie-RefHash@rt.cpan.org\n<mailto:bug-Tie-RefHash@rt.cpan.org>).\n\n### AUTHORS\n\nGurusamy Sarathy <gsar@activestate.com>\n\nTie::RefHash::Nestable by Ed Avis <ed@membled.com>\n\n### CONTRIBUTORS\n\n*   Yuval Kogman <nothingmuch@woobling.org>\n\n*   Karen Etheridge <ether@cpan.org>\n\n*   Florian Ragwitz <rafl@debian.org>\n\n*   Jerry D. Hedden <jdhedden@cpan.org>\n\n### COPYRIGHT AND LICENCE\n\nThis software is copyright (c) 2006 by יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n\n"
        }
    ],
    "structuredContent": {
        "command": "Tie::RefHash",
        "section": "",
        "mode": "perldoc",
        "summary": "Tie::RefHash - Use references as hash keys",
        "synopsis": "require 5.004;\nuse Tie::RefHash;\ntie HASHVARIABLE, 'Tie::RefHash', LIST;\ntie HASHVARIABLE, 'Tie::RefHash::Nestable', LIST;\nuntie HASHVARIABLE;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "use Tie::RefHash;",
            "tie %h, 'Tie::RefHash';",
            "$a = [];",
            "$b = {};",
            "$c = \\*main;",
            "$d = \\\"gunk\";",
            "$e = sub { 'foo' };",
            "%h = ($a => 1, $b => 2, $c => 3, $d => 4, $e => 5);",
            "$a->[0] = 'foo';",
            "$b->{foo} = 'bar';",
            "for (keys %h) {",
            "print ref($), \"\\n\";",
            "tie %h, 'Tie::RefHash::Nestable';",
            "$h{$a}->{$b} = 1;",
            "for (keys %h, keys %{$h{$a}}) {",
            "print ref($), \"\\n\";"
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": [
                    {
                        "name": "perlfunc",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "EXAMPLE",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "THREAD SUPPORT",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "STORABLE SUPPORT",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 1,
                "subsections": [
                    {
                        "name": "perl",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "SUPPORT",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "CONTRIBUTORS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENCE",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}