diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-02-03 19:41:11 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-02-03 19:41:11 +0000 |
commit | 59f00321bbc2d04656a65e0e9ccbbd93a8708e71 (patch) | |
tree | c0f54dac647290fc40828259685a2859be908403 /pod/perl591delta.pod | |
parent | 81e59e001862de98bd8263eb307b4c909c0b16b8 (diff) | |
download | perl-59f00321bbc2d04656a65e0e9ccbbd93a8708e71.tar.gz |
Implement "my $_".
p4raw-id: //depot/perl@22263
Diffstat (limited to 'pod/perl591delta.pod')
-rw-r--r-- | pod/perl591delta.pod | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pod/perl591delta.pod b/pod/perl591delta.pod index 52b54fd751..bf26c2bc75 100644 --- a/pod/perl591delta.pod +++ b/pod/perl591delta.pod @@ -11,6 +11,23 @@ the 5.9.1 release. =head1 Core Enhancements +=head2 Lexical C<$_> + +The default variable C<$_> can now be lexicalized, by declaring it like +any other lexical variable, with a simple + + my $_; + +The operations that default on C<$_> will use the lexically-scoped +version of C<$_> when it exists, instead of the global C<$_>. + +In a C<map> or a C<grep> block, if C<$_> was previously my'ed, then the +C<$_> inside the block is lexical as well (and scoped to the block). + +In a scope where C<$_> has been lexicalized, you can still have access to +the global version of C<$_> by using C<$::_>, or, more simply, by +overriding the lexical declaration with C<our $_>. + =head2 Tied hashes in scalar context As of perl 5.8.2, tied hashes did not return anything useful in scalar |