1. I think it should be foreach instead of forEach (here: help-topic (https://www.photools.com/help/imatch/var_basics.htm?dl=h-230))
sc1.jpg
2. Not completely sure if the output in the examples (https://www.photools.com/help/imatch/var_basics.htm?dl=hid-47) wouldn't look slightly different:
2a. Output -Peter--Paul--Mary- instead of -Peter-Paul-Mary-
2b. Output -Peter (0)--Paul (1)--Mary (2)- instead of -Peter (0)-Paul (1)-Mary (2)-
Fixed thanks. The - at the end was wrong -Peter -Paul -Mary was intended.