Perl provides several super global variables. They’re not scoped to a package or file. They’re really, truly global. Unfortunately, any direct or indirect modifications of these variables may change the behavior of other parts of the program. Experienced Perl hackers have memorized some of them. Few people have memorized all of them—they’re terse. Only a handful are regularly useful. perldoc perlvar contains the exhaustive list of these variables.

Managing super globals

As Perl evolves, it moves more global behavior into lexical behavior, so that we can avoid many of these globals. When we must use them, we use local in the smallest possible scope to constrain any modifications. We're still susceptible to any changes made to these variables from code we call, but we reduce the likelihood of surprising code outside our scope. As the easy file-slurping idiom demonstrates, local is often the right approach:

Get hands-on with 1200+ tech skills courses.