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
Complex Assignment Operators - behaviour differs from the expanded equivalent #13752
Comments
From the.rob.dixon@gmail.comThis is a bug report for perl from the.rob.dixon@gmail.com, This issue was raised as a comment by user `mob` on Stack Overflow here http://stackoverflow.com/questions/23176023/reading-line-by-line-does-not-work#comment35447515_23176172 The problem is that the *compound* assignment operators should behave
should be no different from
The documentation has an exemption for this when it says, in `perlop` under
But there is an additional case where this assertion fails: when the lvalue is a This example pogram derives from another comment from `mob` referred to above. In the simple assignment `exists $hash_a{key}` correctly returns `undef`, and
But in the case of the compound assignment, the element is autovivified My gut feeling is that this may have to be relegated to a documentation bug, This seems especially insidious when there is no way of forcing the order of
still evaluates the lvalue first. use strict; use Data::Dumper; my (%hash_b, %hash_a); $hash_a{key} = $hash_a{key} . exists $hash_a{key}; $hash_b{key} .= exists $hash_b{key}; __END__ *output* Use of uninitialized value in concatenation (.) or string at Flags: Site configuration information for perl 5.16.2: Configured by strawberry-perl at Fri Nov 2 00:34:53 2012. Summary of my perl5 (revision 5 version 16 subversion 2) configuration: Platform: Locally applied patches: @INC for perl 5.16.2: Environment for perl 5.16.2: |
From @jkeenanOn Tue Apr 22 16:50:24 2014, the.rob.dixon@gmail.com wrote:
[snip]
[snip]
Would you be able to provide a patch to pod/perlop.pod which addresses this issue? Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @ikegamiOn Wed, Jun 11, 2014 at 8:31 PM, James E Keenan via RT <
Current: `$a += 2` is equivalent to `$a = $a + 2` although without duplicating any Proposed: `$a += 2` is equivalent to `$a = $a + 2` except that $a is only evaluated Overkill: `$a += 2` is equivalent to `$a = $a + 2` except that $a is only evaluated |
From @ikegamiOn Wed, Jun 11, 2014 at 9:24 PM, Eric Brine <ikegami@adaelis.com> wrote:
I left the tie bit in without thinking. What difference is there between |
Migrated from rt.perl.org#121703 (status was 'open')
Searchable as RT121703$
The text was updated successfully, but these errors were encountered: