If you want the user to have a directory set by default the next time he runs your program, then you'll have to 'save state'. Try using a config file, where you write the directory the user chose, and have your program reading that file at the begining and look for that info. The first time the program is executed that information will not be there, but there will be something the next time.
update: below is some code you can adapt to include in your program. Error checking on dealing with the file is not in the script, as I don't know TK (and how to, visually, alert the user in case of errors) and I would have the script dieing. Run the script and look at config.txt's contents, and then modify the value of the variable $new_default, run it again and look for differences.
use strict;
use warnings;
my $file = "config.txt";
my $default_dir = "";
my @config;
my $content;
if (-f $file) {
open CONF, "<$file";
$content = <CONF>;
close CONF;
if ($content =~ /DEFAULT_DIR/) {
@config = split /:/,$content;
$default_dir = $config[1];
}
}
my $new_default = "default_path";
if($new_default ne $default_dir) {
open CONF, ">$file";
print CONF "DEFAULT_DIR:".$new_default;
close CONF;
}
After all this, do go and take a look at open. It is important that you know how to deal with files.