Skip to content

Commit 41c9e4b

Browse files
committed
Mention that sigilless vars do not enforce context
1 parent 4554a51 commit 41c9e4b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/Language/variables.pod

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ assigning to one after you've defined it:
119119
120120
θ = 3; # Dies with the error "Cannot modify an immutable Num"
121121
122+
Sigilless variables do not enforce context, so they can be used to pass
123+
something on as-is:
124+
125+
sub logged(&f, |args) {
126+
say('Calling ' ~ &f.name ~ ' with arguments ' ~ args.perL)
127+
my \result = f(|args);
128+
# ^^^^^^^ not enforcing any context here
129+
say(&f.name ~ ' returned ' ~ result.perl)
130+
return |result;
131+
}
132+
122133
=head1 Twigils
123134
124135
Twigils influence the scoping of a variable. Please be aware that twigils

0 commit comments

Comments
 (0)