Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Closure warning with Perl 5.14?

by BrowserUk (Pope)
on May 19, 2011 at 04:51 UTC ( #905638=note: print w/replies, xml ) Need Help??


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 CEST

    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://905638]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2021-01-25 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?