New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug or wrong doc for 'foreach $lexical' #7224
Comments
From @hfuruCreated by @hfuruAbout `foreach $var (...)', the perlsyn manual page says, If the variable was previously declared with "my", it uses That is not true. It creates a new lexical variable for the loop with but it's still localized to the loop. but that does not really make sense. That sounds like the value of the my $var = "original value"; BTW, I think this is a misfeature which should get a warning. If one Perl Info
|
From @jkeenanOn Thu Apr 08 21:35:31 2004, h.b.furuseth@usit.uio.no wrote:
While reviewing older tickets, I have read this several times. Each But then, when I go and read 'perldoc perlsyn' (the section on "Foreach So I don't think there's a bug here, and the current documentation makes What do other people think? Thank you very much.
u1/hbf/bin/linux:/local/bin:/local/gnu/bin:/local/sbin:/usr/bin/X11:/usr/X11R6/bin:/usr/bin:/bin:/usr/games
|
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Sat Dec 17 20:02:40 2011, jkeenan wrote:
I think this is a can of worms I don’t want to open. :-( It makes me wonder: If we introduce lexical aliases through lvalue my $x = 3; my $y = 4; I think the original poster has a point. This doesn’t do what the $ perl5.15.5 -le 'my $x = 3; my $sub = sub { print $x }; for $x (4){&$sub}' -- Father Chrysostomos |
From @cpansproutOn Sat Dec 17 23:14:17 2011, sprout wrote:
It works for our variables: perl -le 'our $x; $sub = sub { print $x }; for $x(4) { &$sub }' -- Father Chrysostomos |
From @druud62On 2011-12-18 05:02, James E Keenan via RT wrote:
I don't like the implicit localization. perl -wle ' I consider this magic-for-magic-only: perl -wle ' (ok, not for magic only, good (and bad) for golfing too) -- |
Migrated from rt.perl.org#28396 (status was 'open')
Searchable as RT28396$
The text was updated successfully, but these errors were encountered: