I translate "Understand Perl Scope" from Japanese to English

I translate "Understand Perl Scope" from Japanese to English

Understand Perl ScopeUnderstand Perl Scope

Perl scope concept is very good. This is more understandable than other language.

1 Comment

The tutorial claims that there are no exceptions to the rule that "{" and "}" begin and end a scope. There are exceptions!

Firstly, the whole file itself is a lexical scope. Lexicals declared in one file are not normally visible to code in another file.

Also, an exception in the other direction: braces do not begin and end a scope if they're used to create a hashref:

   use strict;
      (my $x = 42), undef
   print "$x\n";

Leave a comment

About Yuki Kimoto

user-pic I'm Yuki Kimoto, Japanese Perl programmer.I create Perl modules and applications. GitPrep, SPVM, DBIx::Custom, Validator::Custom, Test::Mojo, Mojolicious::Plugin::AutoRoute, etc.