Skip to content

Commit 4cff385

Browse files
committed
Little improvement to the list assignment regarding my and our.
Related to issue #1958
1 parent 2e96dd3 commit 4cff385

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/Language/variables.pod6

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,13 @@ introduce an alias into the symbol table.
529529
530530
# Available as $M::Var here.
531531
532-
=head2 Declaring a list of variables
532+
=head2 Declaring a list of variables lexically (C<my>) or package (C<our>) scoped
533533
534-
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.
534+
It is possible to scope more than one variable at a time, but both C<my>
535+
and C<our> require variables to be placed into parentheses:
535536
536-
my (@a, $s, %h);
537+
my (@a, $s, %h); # same as my @a; my $s; my %h;
538+
our (@aa, $ss, %hh); # same as our @aa; our $ss; our %hh;
537539
538540
This can be used in conjunction with X«destructuring assignment». Any
539541
assignment to such a list will take the number of elements provided in the left

0 commit comments

Comments
 (0)