The problem is that you are performing a long-running task on the GUI thread and not returning control to the Tk MainLoop often enough. This is a fundamental mismatch, since Tk is event-based and long-running callbacks will hang the GUI. I usually encounter this with network interaction when combining Tk and LWP in the same program; my usual solution is to fork and handle LWP operations in child processes, passing results back over a pair of pipes (one monitored by Tk in non-blocking mode and one in blocking mode for passing large binary results up using Storable) but this probably will not work well on Windows.
I suggest looking into the threads support in perl; you may need a few shared variables for passing state between the threads. I have no idea how to get the Tk event loop to handle thread completion.