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.
Autark.
|
---|
In Section
Seekers of Perl Wisdom