summaryrefslogtreecommitdiffhomepage
path: root/perl6.html.markdown
diff options
context:
space:
mode:
authorLeo Bärring <leo.barring@gmail.com>2015-12-26 20:15:51 +0100
committerLeo Bärring <leo.barring@gmail.com>2015-12-26 20:15:51 +0100
commit5556d6e839796e06179afec99443bf0a63a23afa (patch)
treebd45ab2219f12ce93df223911b30c30a09c886f9 /perl6.html.markdown
parentb2133b532b0e8bc0ae6e704633b56743eaa9b339 (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.
Diffstat (limited to 'perl6.html.markdown')
-rw-r--r--perl6.html.markdown3
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