while(1){ last if Win32::GUI::DoEvents() != -1; last if $win->PostQuitMessage; }