in reply to Exempting through search
$semi_count += () = m{;(?!\s*End)}g; [download]
update: added the \s* (didn't see the space initially)