diff options
author | Leo Bärring <leo.barring@gmail.com> | 2015-12-26 20:15:51 +0100 |
---|---|---|
committer | Leo Bärring <leo.barring@gmail.com> | 2015-12-26 20:15:51 +0100 |
commit | 5556d6e839796e06179afec99443bf0a63a23afa (patch) | |
tree | bd45ab2219f12ce93df223911b30c30a09c886f9 | |
parent | b2133b532b0e8bc0ae6e704633b56743eaa9b339 (diff) |
changed code output to as stated in comments
The comments state that Foo::Bar::inc in the package variable example should increase $Foo::Bar::n and then print it.
This did not happen, as `say ++$n;` was placed outside the block of the sub Foo::Bar::inc.
The commit puts `say ++$n;` inside the block of Foo::Bar::inc.
-rw-r--r-- | perl6.html.markdown | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/perl6.html.markdown b/perl6.html.markdown index 1829f964..1457999a 100644 --- a/perl6.html.markdown +++ b/perl6.html.markdown @@ -803,9 +803,8 @@ module Foo::Bar { my sub unavailable { # `my sub` is the default say "Can't access me from outside, I'm my !"; } + say ++$n; # increment the package variable and output its value } - - say ++$n; # lexically-scoped variables are still available } say $Foo::Bar::n; #=> 1 Foo::Bar::inc; #=> 2 |