Yes !! That was it. Inserting:
in reply to Re: Can't build Inline::C on Cygwin
in thread Can't build Inline::C on Cygwin
into /etc/profile fixes the problem.
And I had come across this problem before. It's a fix that I had applied to a Cygwin installation on another box ... and then forgotten about (until now).
Thanks for managing to dig that up. I searched Google for "/bin/sh: -c: line 0: unexpected EOF while looking for matching" and "perl" ... which for some reason fails to find a match. Now that I try a Google without the "/bin/sh: -c: line 0:" bit, I find much better results (including the post you referenced).