my gui script creates checkbox (along with some other lables and buttons), when certain tasks are done, more checkboxes (with same name) are created, this creates many unnecessary reference/handle in memory and sometime hangs or crash... how to destroy gui object created after certain task is done, before program exit? thanks

[...]
#create checkbox for each option...
    foreach my $index (0..Win32::GUI::Combobox::Count($optionID)-1) {
      my $objName = "$optionID\_$index";
      my $string = Win32::GUI::Combobox::GetString($optionID, $index);
      $MainWin->AddCheckbox (
        -name    => $objName,
        -text    => $string,
        -left    => 120 + 110 * $x_offset,
        -top     => $y_pos,
        -width   => 100,
        -height  => 18,
      );

[...]

### not sure how to destory, just hiding previously created checkbox/stuff
 foreach my $key (keys %$MainWin) {
    if ($key =~ /^(Tab$sel\_.+)$/) {
            $MainWin->$key->Hide();
      $MainWin->$key->Disable();
      $MainWin->$key->Resize(0,0); 
      undef $key;
      -1;
    } elsif ($key !~ /^-/) {
    }
  }
[...]


Do you Yahoo!?
With a free 1 GB, there's more in store with Yahoo! Mail.