in reply to Break perl foreach loop

Are you sure the last WID; statement is being hit ?

Aside:

Proper indentation would help you enormously - I had to copy the text into a syntax sensitive editor just to determine the correlation between opening and closing braces.

A user level that continues to overstate my experience :-))