Skip to content

Commit

Permalink
Call a hash %hash in the documentation
Browse files Browse the repository at this point in the history
Previously, %array was used which was confusing.
  • Loading branch information
E. Choroba authored and tonycoz committed Dec 10, 2018
1 parent 2a0bbd3 commit f06965b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pod/perlref.pod
Original file line number Diff line number Diff line change
Expand Up @@ -603,23 +603,23 @@ Similarly, because of all the subscripting that is done using single words,
the same rule applies to any bareword that is used for subscripting a hash.
So now, instead of writing

$array{ "aaa" }{ "bbb" }{ "ccc" }
$hash{ "aaa" }{ "bbb" }{ "ccc" }

you can write just

$array{ aaa }{ bbb }{ ccc }
$hash{ aaa }{ bbb }{ ccc }

and not worry about whether the subscripts are reserved words. In the
rare event that you do wish to do something like

$array{ shift }
$hash{ shift }

you can force interpretation as a reserved word by adding anything that
makes it more than a bareword:

$array{ shift() }
$array{ +shift }
$array{ shift @_ }
$hash{ shift() }
$hash{ +shift }
$hash{ shift @_ }

The C<use warnings> pragma or the B<-w> switch will warn you if it
interprets a reserved word as a string.
Expand Down

0 comments on commit f06965b

Please sign in to comment.