The following technique is useful when the window you want to hide isn't the one you're interacting with. You can see the program's console output if you run it from a command prompt; but if you launch the script from Explorer (double-click; Start>Run, etc.), this hides the window.
use Win32::API;
sub hide_console
{
Win32::API->new( 'kernel32', 'FreeConsole', [], 'I' )->Call();
}