# New Ticket Created by  Sam S. 
# Please include the string:  [perl #128054]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128054 >


Golfed example:

    say ("{$_}") for <aa bb>;

Expected behavior:  Print the lines "aa" and "bb".

Actual behavior:  Prints two empty lines, and emits two "Use of uninitialized 
value $_ of type Any in string context" warnings.


By comparison, all of the following variations works fine:

    say "{$_}" for <aa bb>;
    say ("$_") for <aa bb>;
    say ("$($_)") for <aa bb>;
    say ("{$_}" for <aa bb>);
    for <aa bb> { say ("{$_}") };


This means that the problem only occurs when all of the following situations 
coincide:

1) The topic $_ is set by a statement modifier (and not, say, the block form of 
`given`/`for`).
2) The string is enclosed in parens which *don't* also enclose the statement 
modifier.
3) The string has a {}-interpolated expression which tries to access $_.


This failure mode is very similar to one in RT #126569, so the two bugs are 
probably related.

Reply via email to