I'm using the following sub-routine to create butons on the fly for my Tk app, but my problem is that for every call to the routine the new buttons are getting appended to the old. (i.e. my list of buttons grows.) Does anyone know of a simple solution to the problem?
sub button_setup($prog_select) {
my $prog = shift;
foreach my $key (keys %{$button{$prog}}) {
my $key = $buttons->Button(
-text => $key,
-width => '10',
-command => sub {system "$button{$prog}{$key}";}
)->pack(-side => 'top', -pady=>'10');
}
}