I have found out how to make it work, on the first line I changed it to:
#!/usr/bin/perl -w
It now works, I am not sure why the -w works, can someone explain why this works, I don't quite understand it.
If no-one knows, at least this is out there for reference.