Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2016-10-27 23:22 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (372 votes). Check out past polls.