1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-20 05:21:26 +02:00

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.
This commit is contained in:
Leo Bärring
2015-12-26 20:15:51 +01:00
parent b2133b532b
commit 5556d6e839

View File

@@ -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