Previously, %array was used which was confusing.
the same rule applies to any bareword that is used for subscripting a hash.
So now, instead of writing
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" }
- $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
and not worry about whether the subscripts are reserved words. In the
rare event that you do wish to do something like
you can force interpretation as a reserved word by adding anything that
makes it more than a bareword:
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.
The C<use warnings> pragma or the B<-w> switch will warn you if it
interprets a reserved word as a string.