in reply to regex clarification

What is happening is that the regex engine tries real hard to succeed. It greedily will grab as much as it can, and then back off if it means it can still succeed.

In the first row it matches the start of your line then David, but then it notices that David is followed by whitespace and then Vet, so this is a failure. So it backs up a letter and tries again. So now it matches Davi which is not followed by whitespace followed by Vet, so it is a successful match and as such you put Davi into the array. With Jackie it does not fail so it does not backup any letters just puts Jackie into the array, and then finally on the final line it tries Karen finds that it fails backs up a letter for Kare which of course succeeds for the same reason that Davi succeeded above, and viola you get the results you see.

FWIW here is one to do what intended to do in the first place with a regex:

while (<>) { push(@array, $&) if m/^(?>\w+)(?!\s+Vet)/; } print("@array\n");
Though that is only one way, and probably not the most efficient.