Hmm, what perl version are you using (and what operating system)? I suspect it's the perl environment that causes the problem. I have tried both strawberry perl 5.12.3.0 and 5.14.2.1 on Windows 7.
And I fixed the bugs. I made mistakes during copy and paste.