On form submission check if similar record exists

On form submission check if similar record exists

I want to run a check on each form submission. It should check all existing records on any matching records based on two fields, DOB and Last name. If a match is found it should send an email.

I think I am close but not exactly the right code. Can anyone help?
Tried this as a workflow on created on success:
  1. pnRecord = Register[ID != 0];
  2. for each  pn in pnRecord
  3. {
  4. //fetch matching person records by DOB and last name
  5. pm = input.Date_of_Birth == pn.Date_of_Birth && input.Name.last_name == pn.Name.last_name;
  6. //if any found then send email
  7. if(pm.count() > 0)
  8. {
  9. sendmail
  10.             [
  11. from :zoho.adminuserid
  12. to :zoho.adminuserid
  13. subject :"DOUBLE FOUND"
  14. message : input.Name
  15.             ]
  16. }
  17. }
Probably goes wrong at line 6. Not sure how to properly code the count line.
Thanks