File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,25 @@ C<$*dynamic2> is still C<101>. This stems from the fact that we declared a
193
193
new dynamic variable C < $*dynamic1 > in the block and did not assign to the
194
194
old variable as we did with C < $*dynamic2 > .
195
195
196
+ The dynamic variables differ from other variable types in that refering
197
+ to an undeclared dynamic variable is not a compile time error but a
198
+ runtime L < failure|/type/Failure > , so a dynamic variable variable can be
199
+ used undeclared as long as it is checked for definedness or used in a
200
+ boolean context before using it for anything else:
201
+
202
+ = begin code
203
+ sub foo() {
204
+ $*FOO // 'foo';
205
+ }
206
+
207
+ say foo; # -> 'foo'
208
+
209
+ my $*FOO = 'bar';
210
+
211
+ say foo; # -> 'bar'
212
+ = end code
213
+
214
+
196
215
= head2 The C < ! > Twigil
197
216
198
217
Attributes are variables that exist per instance of a class. They may be
You can’t perform that action at this time.
0 commit comments