Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Perl/Tk command execution weirdness

by autark (Friar)
on Dec 11, 2000 at 23:00 UTC ( #46116=note: print w/replies, xml ) Need Help??

in reply to Perl/Tk command execution weirdness

The reason is actually quite obvious once you see why. When you use an anonymous array to create the callback for your button, you create it once and only once. That means that the array will contain f.exs: [CODE(0x80e4ec), ''] The empty string ('') probably would be the output of $directory->get() at the start of the program, so that is what you send to the function.

Now, when you use an anonymous function, and within it use the code to fetch the output from the Entry widget, it will be called every time. Thus - $directory->get() will be called each time you press the button. This is in contast to the anonymous array, where the get() function only will be called once - when you create the array.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2020-11-24 10:20 GMT
Find Nodes?
    Voting Booth?

    No recent polls found