in reply to perl/tk script freezes

As originally posted, your script has the "DoOneEvent" call outside of the inner-most "for" loop, running the range of numbers in the fourth part of the IP addresses. If you have been trying the script with the default values for the start and stop IP addresses (1.1.1.1 - 1.1.1.255), this means that you run 255 iterations of the inner-most loop (calling Net::SNMP->session each time, with a 2-sec time-out) before you get to the first "DoOneEvent" call.

Have you allowed the script to run for at least 8 min. 30 sec, to let that inner loop finish? How about putting the DoOneEvent call inside that loop, rather than after it? Better yet, you might want to add a label widget with a "-textvariable =>\$status_string option, update that variable with the ip address being scanned, and call that widget's update method within the inner-most loop, so you can see what's happening inside that loop as it happens.

A few other comments about your code: