Skip to content

Commit 3099e5c

Browse files
authored
expand with more paractical examples
1 parent 2e328ee commit 3099e5c

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

doc/Language/packages.pod6

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,20 @@ immediately or is continued with another C<::> outside the parentheses.
124124
Most symbolic references are done with this notation:
125125
126126
=for code :skip-test
127-
$foo = "Bar";
128-
$foobar = "Foo::Bar";
129-
$::($foo) # lexically-scoped $Bar
130-
$::("MY::$foo") # lexically-scoped $Bar
131-
$::("OUR::$foo") # package-scoped $Bar
132-
$::("GLOBAL::$foo") # global $Bar
133-
$::("PROCESS::$foo")# process $Bar
134-
$::("PARENT::$foo") # current package's parent's $Bar
135-
$::($foobar) # $Foo::Bar
136-
$::($foobar)::baz # $Foo::Bar::baz
137-
$::($foo)::Bar::baz # $Bar::Bar::baz
138-
$::($foobar)baz # ILLEGAL at compile time (no operator baz)
127+
my $foo = "Foo";
128+
my $bar = "Bar";
129+
my $foobar = "Foo::Bar";
130+
$::($bar) # lexically-scoped $Bar
131+
$::("MY::$bar") # lexically-scoped $Bar
132+
$::("OUR::$bar") # package-scoped $Bar
133+
$::("GLOBAL::$bar") # global $Bar
134+
$::("PROCESS::$bar") # process $Bar
135+
$::("PARENT::$bar") # current package's parent's $Bar
136+
$::($foobar) # $Foo::Bar
137+
@::($foobar)::baz # @Foo::Bar::baz
138+
@::($foo)::Bar::baz # @Bar::Bar::baz
139+
@::($foobar)baz # ILLEGAL at compile time (no operator baz)
140+
@::($foo)::($bar)::baz # @Foo::Bar::baz
139141
140142
An initial C<::> doesn't imply global. Here as part of the interpolation
141143
syntax it doesn't even imply package. After the interpolation of the

0 commit comments

Comments
 (0)