http://www.perlmonks.org?node_id=905638


in reply to Re^2: Closure warning with Perl 5.14?
in thread Closure warning with Perl 5.14?

But shouldn't there be a warning in 5.12?

Perhaps this is a new warning for old problem added in 5.14 to help us.

I don't get a warning from this in 5.14.0: ...

No. There is no closure involved there.

Try:

use warnings; use strict; my $x = <>; my $y = "X" if $x =~ /X/; sub x{ print $y ? 'Okay' : 'bad'; } print "$y\n";

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: Closure warning with Perl 5.14?
by BerntB (Deacon) on May 19, 2011 at 08:56 UTC

    Still no warning, $y is declared as it always was.

    (But you get a warning for an uninitialized value in a concatenation, potentially, etc.)

      I couldn't test it as I don't have 5.14 yet. You'll have to play around to discover teh exact circumstances under which it occurs.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.