Skip to content

Commit

Permalink
Little improvement to the list assignment regarding my and our.
Browse files Browse the repository at this point in the history
Related to issue #1958
  • Loading branch information
fluca1978 committed Apr 24, 2018
1 parent 2e96dd3 commit 4cff385
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions doc/Language/variables.pod6
Expand Up @@ -529,11 +529,13 @@ introduce an alias into the symbol table.
# Available as $M::Var here.
=head2 Declaring a list of variables
=head2 Declaring a list of variables lexically (C<my>) or package (C<our>) scoped
The declarators C<my> and C<our> take a list of variables in parentheses as argument to declare more than one variable at a time.
It is possible to scope more than one variable at a time, but both C<my>
and C<our> require variables to be placed into parentheses:
my (@a, $s, %h);
my (@a, $s, %h); # same as my @a; my $s; my %h;
our (@aa, $ss, %hh); # same as our @aa; our $ss; our %hh;
This can be used in conjunction with X«destructuring assignment». Any
assignment to such a list will take the number of elements provided in the left
Expand Down

0 comments on commit 4cff385

Please sign in to comment.