in reply to Perl/Tk command execution weirdness

autark is correct. So I'd write this as:

my $newBtn= $upper->Button( '-text' => "New Subdirectory", '-command' => sub { newDir( $direntry->get() ) }, )->grid( '-column' => 1, '-row' => 1 );
(someone asked me about that).

Also note that current versions of Perl don't ever free anonymous subroutines (because of a reference loop in how they are tracked) so if you replace that button or its action, you now leak memory. (I have a neat Tk app that leaks memory like fishnet because I'm constantly replacing buttons/actions as the state of things change.)

        - tye (but my friends call me "Tye")