Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Closure warning with Perl 5.14?

by BrowserUk (Patriarch)
on May 19, 2011 at 08:51 UTC ( [id://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 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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2025-03-27 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (70 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.