Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991371]
help
Chatterbox?
[ambrus]: erix: further, SQLite may be the second most installed piece of software on earth after zlib.
[erix]: heh, really? yeah, I suppose it may be so

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2017-09-25 14:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (280 votes). Check out past polls.

    Notices?