in reply to Exempting through search

You could use the m// operator:

$semi_count += () = m{;(?!\s*End)}g;

update: added the \s* (didn't see the space initially)