See Original text in context
multi sub trait_mod:<is>(Variable, :)
Marks a variable as dynamic, that is, accessible from inner dynamic scopes without being in an inner lexical scope.
sub introspect()my <strong>is dynamic</strong> = 23;introspect; # OUTPUT: «23»
The is dynamic
trait is a rather cumbersome way of creating and accessing dynamic variables. A much easier way is to use the * twigil
:
sub introspect()my = 23;introspect; # OUTPUT: «23»