Scope modifiers: Difference between revisions

m
→‎{{header|Perl}}: Changed count of declarations to match the introduction of 'state'
(→‎{{header|Perl}}: Reintegrated the discussion of 'state'.)
m (→‎{{header|Perl}}: Changed count of declarations to match the introduction of 'state')
Line 289:
By default, an unqualified name refers to a package variable in the current package. The current package is whatever you set it to with the last <code>package</code> declaration in the current lexical scope, or <code>main</code> by default. But wherever stricture is in effect, using a name that would be resolved this way is a compile-time error.
 
There are threefour kinds of declaration that can influence the scoping of a particular variable: <code>our</code>, <code>my</code>, <code>state</code>, and <code>local</code>. <code>our</code> makes a package variable lexically available. Its primary use is to allow easy access to package variables under stricture.
 
<lang perl>use strict;
256

edits