$x != "Patient" is wrong. If you want to test string inequality use ne.
In reply to Re: Break perl foreach loop by GrandFather in thread Break perl foreach loop by pvecchio