in reply to perl tk MainLoop hangs

The script runs without error upto the MaonLoop

Yes, MainLoop is supposed to hang, that's what MainLoop does