Do you mean when you application exits, because Win32::GUI generally takes care of the destruction of any windows on exit. Sometimes, however, you may receive an error along the lines of "Can't call method STORE on an undefined value...". In which case, you can just undef() your windows before you exit to suppress these messages.

If you are needing to reuse windows, then hiding them instead of destroying them could be better, since there would probably be some overhead in creating a window each time it is needed. You would just have to remember to reset all the window's controls when the window is needed again. I know for programs I have written that use a lot of windows, there are a lot which are created, and then shown using DoModal(), in subroutines that are called from events, so they are automatically destroyed when the subroutine returns. I could probably improve performance by creating them beforehand, but I suppose it depends on the situation. I have also seen code where the windows are hidden after the Win32::GUI::Dialog() call, before the program exits. I am not sure if there is anything to be gained from this; again, it all comes down to personal preference.

There's no functional difference between
"Label${Counter}" and "Label$Counter", it's just that putting braces around the names of variables in strings prevents Perl from thinking that trailing alphanumeric characters are part of the variable name. For instance, if you had the string "$CounterLabel" instead, then Perl would look for a $CounterLabel variable. Check out the perldata manpage for more info. It's just a habit that I have gotten into to make variables in strings clearer.


Find it at CarPoint.com.au New, Used, Demo, Dealer or Private?