On Tue, 04 Dec 2007, Justin Allegakoen wrote:
> --------------8<---------------
> Note that you can have a lexical $_ in 5.10:
>
> foreach my $_ ( @foo ) {
> s/SID/12345/;
> }
> --------------8<---------------
>
> Arrrrgggghhhh! Why is that considered a good feature to add to 5.10?
>
> Sure scoping and all, but do the other perlvars behave the same? I
> kind of like the local rule of thumb for perlvar . . .
This is special-cased for $_. From perlvar.pod:
| As C<$_> is a global variable, this may lead in some cases to unwanted
| side-effects. As of perl 5.9.1, you can now use a lexical version of
| C<$_> by declaring it in a file or in a block with C<my>. Moreover,
| declaring C<our $_> restores the global C<$_> in the current scope.
Cheers,
-Jan
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs