diff options
Diffstat (limited to 'perl6.html.markdown')
| -rw-r--r-- | perl6.html.markdown | 7 | 
1 files changed, 3 insertions, 4 deletions
| diff --git a/perl6.html.markdown b/perl6.html.markdown index 1829f964..5082a433 100644 --- a/perl6.html.markdown +++ b/perl6.html.markdown @@ -103,7 +103,7 @@ sub say-hello-to(Str $name) { # You can provide the type of an argument  ## It can also have optional arguments:  sub with-optional($arg?) { # the "?" marks the argument optional -  say "I might return `(Any)` (Perl's "null"-like value) if I don't have +  say "I might return `(Any)` (Perl's 'null'-like value) if I don't have          an argument passed, or I'll return my argument";    $arg;  } @@ -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 @@ -1330,7 +1329,7 @@ so 'ayc' ~~ / a [ b | y ] c /; # `True`. Obviously enough ... -### Extra: the MAIN subroutime +### Extra: the MAIN subroutine  # The `MAIN` subroutine is called when you run a Perl 6 file directly.  # It's very powerful, because Perl 6 actually parses the arguments  #  and pass them as such to the sub. It also handles named argument (`--foo`) | 
