in reply to perl regexp question excluding strings

Untested:
while (<>) { if (my $name = /Servername (.*)/) { next if /^Context Servername/; next if /Servername Context/; print $name, "\n"; } }