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
'my()' incorrectly scoped in 'xxx if yyy' statement. #4642
Comments
From stevep@marketview.co.nzCreated by stevep@marketview.co.nzThe following code should, in my opinion, print five lines, with the use strict; sub foo { my $bar = 'baz' if $_[0]; return $bar; print foo(0), "\n"; Instead it prints: quux This behaviour violates DWIM, and/or 'use strict'. It violates DWIM because I wouldn't expect 'my()' to be scoped in this my $bar; Even if it was expected that 'my()' would work like that, then it Perl Info
|
From @tamiasOn Wed, Dec 05, 2001 at 06:34:07PM +1300, Steve Piner wrote: Thank you for your bug report.
my has both a compile time effect and a run time effect. The compile time This behavior was unintentional, but there is now code that depends on it, In conclusion, don't do that. :) Ronald |
Migrated from rt.perl.org#7982 (status was 'resolved')
Searchable as RT7982$
The text was updated successfully, but these errors were encountered: