Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^6: Clearing anonymous Tk widgets

by Anonymous Monk
on Sep 03, 2012 at 07:08 UTC ( #991371=note: print w/ replies, xml ) Need Help??


in reply to Re^5: Clearing anonymous Tk widgets
in thread Clearing anonymous Tk widgets

Here is a simpler example

#!/usr/bin/perl -- use strict; use warnings; my @closures ; for( 1 .. 3 ){ my $me = $_; # lexical $me push @closures, sub { print "You got $me\n"; # lexical $me }; } $_->() for @closures; shift(@closures)->(); $_->() for @closures; __END__ You got 1 You got 2 You got 3 You got 1 You got 2 You got 3
See also Tutorials: Variable Scoping in Perl: the basics, Coping with Scoping , Mini-Tutorial: Perl's Memory Management, Lexical scoping like a fox


Comment on Re^6: Clearing anonymous Tk widgets
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (18)
As of 2015-07-01 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (14 votes), past polls