{
    "content": [
        {
            "type": "text",
            "text": "# access (perldoc)\n\n## Section Outline\n\n- **Found in /usr/share/perl/5.34/pod/perlfaq4.pod** (17 lines)\n- **Found in /usr/share/perl/5.34/pod/perlfaq7.pod** (38 lines)\n\n## Full Content\n\n### Found in /usr/share/perl/5.34/pod/perlfaq4.pod\n\nHow can I access or change N characters of a string?\nYou can access the first characters of a string with substr(). To get\nthe first character, for example, start at position 0 and grab the\nstring of length 1.\n\nmy $string = \"Just another Perl Hacker\";\nmy $firstchar = substr( $string, 0, 1 );  #  'J'\n\nTo change part of a string, you can use the optional fourth argument\nwhich is the replacement string.\n\nsubstr( $string, 13, 4, \"Perl 5.8.0\" );\n\nYou can also use substr() as an lvalue.\n\nsubstr( $string, 13, 4 ) =  \"Perl 5.8.0\";\n\n### Found in /usr/share/perl/5.34/pod/perlfaq7.pod\n\nHow can I access a dynamic variable while a similarly named lexical is in scope?\nIf you know your package, you can just mention it explicitly, as in\n$SomePack::var. Note that the notation $::var is not the dynamic $var\nin the current package, but rather the one in the \"main\" package, as\nthough you had written $main::var.\n\nuse vars '$var';\nlocal $var = \"global\";\nmy    $var = \"lexical\";\n\nprint \"lexical is $var\\n\";\nprint \"global  is $main::var\\n\";\n\nAlternatively you can use the compiler directive our() to bring a\ndynamic variable into the current lexical scope.\n\nrequire 5.006; # our() did not exist before 5.6\nuse vars '$var';\n\nlocal $var = \"global\";\nmy $var    = \"lexical\";\n\nprint \"lexical is $var\\n\";\n\n{\nour $var;\nprint \"global  is $var\\n\";\n}\n\nHow can I catch accesses to undefined variables, functions, or methods?\nThe AUTOLOAD method, discussed in \"Autoloading\" in perlsub lets you\ncapture calls to undefined functions and methods.\n\nWhen it comes to undefined variables that would trigger a warning under\n\"use warnings\", you can promote the warning to an error.\n\nuse warnings FATAL => qw(uninitialized);\n\n"
        }
    ],
    "structuredContent": {
        "command": "access",
        "section": "-q",
        "mode": "perldoc",
        "summary": null,
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "Found in /usr/share/perl/5.34/pod/perlfaq4.pod",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "Found in /usr/share/perl/5.34/pod/perlfaq7.pod",
                "lines": 38,
                "subsections": []
            }
        ],
        "sections": {
            "Found in /usr/share/perl/5.34/pod/perlfaq4.pod": {
                "content": "How can I access or change N characters of a string?\nYou can access the first characters of a string with substr(). To get\nthe first character, for example, start at position 0 and grab the\nstring of length 1.\n\nmy $string = \"Just another Perl Hacker\";\nmy $firstchar = substr( $string, 0, 1 );  #  'J'\n\nTo change part of a string, you can use the optional fourth argument\nwhich is the replacement string.\n\nsubstr( $string, 13, 4, \"Perl 5.8.0\" );\n\nYou can also use substr() as an lvalue.\n\nsubstr( $string, 13, 4 ) =  \"Perl 5.8.0\";\n",
                "subsections": []
            },
            "Found in /usr/share/perl/5.34/pod/perlfaq7.pod": {
                "content": "How can I access a dynamic variable while a similarly named lexical is in scope?\nIf you know your package, you can just mention it explicitly, as in\n$SomePack::var. Note that the notation $::var is not the dynamic $var\nin the current package, but rather the one in the \"main\" package, as\nthough you had written $main::var.\n\nuse vars '$var';\nlocal $var = \"global\";\nmy    $var = \"lexical\";\n\nprint \"lexical is $var\\n\";\nprint \"global  is $main::var\\n\";\n\nAlternatively you can use the compiler directive our() to bring a\ndynamic variable into the current lexical scope.\n\nrequire 5.006; # our() did not exist before 5.6\nuse vars '$var';\n\nlocal $var = \"global\";\nmy $var    = \"lexical\";\n\nprint \"lexical is $var\\n\";\n\n{\nour $var;\nprint \"global  is $var\\n\";\n}\n\nHow can I catch accesses to undefined variables, functions, or methods?\nThe AUTOLOAD method, discussed in \"Autoloading\" in perlsub lets you\ncapture calls to undefined functions and methods.\n\nWhen it comes to undefined variables that would trigger a warning under\n\"use warnings\", you can promote the warning to an error.\n\nuse warnings FATAL => qw(uninitialized);\n",
                "subsections": []
            }
        }
    }
}