title: How can I close a window in Perl/Tk?
body: <p>In my Perl/Tk script I have opened two windows. After a specific button click I want to close one of them. How can I do that? Here's what I have so far:</p>
  
  <pre><code>$main = new MainWindow;
  $sidebar = $main-&gt;Frame(-relief =&gt; "raised", 
                          -borderwidth =&gt; 2)
                  -&gt;pack (-side=&gt;"left" ,
                          -anchor =&gt; "nw", 
                          -fill   =&gt; "y");
  $Button1 = $sidebar -&gt; Button (-text=&gt;"Open\nNetlist", 
                                 -command=&gt;  \&amp;GUI_OPEN_NETLIST) 
                      -&gt;pack(-fill=&gt;"x");
  MainLoop;
  
  sub GUI_OPEN_NETLIST
  {
      $component_dialog = new MainWindow;
      $Button = $component_dialog -&gt; Button (-text=&gt;"Open\nNetlist", 
                                             -command=&gt;  **close new window**) 
                                  -&gt;pack(-fill=&gt;"x"); 
      MainLoop;
  }
  </code></pre>