http://www.perlmonks.org?node_id=1042664


in reply to unknown syntax error

Unrelated to the error but:

(1) This is probably wrong as you're ||-ing "$np[$a] eq $np[$b]" with itself:
34: if($np[$a] eq $np[$b] || $np[$a] eq $np[$b] || $np[$b] eq $np[$c]) ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ once and again

Maybe you meant:
v v 34: if($np[$a] eq $np[$b] || $np[$a] eq $np[$c] || $np[$b] eq $np[$c]) ^ ^


(2) Also your rexexps m/^\d.+/ can be simplified very slightly to m/^\d./ ie remove the +.
(I only mention this incase your rexexps are wrong.)