Look, that's bullshit. There is no such thing as a hacking language. Also, neither of the two languages are more secure than the other. It's simply a matter of how you make it. If you are more proficient in Perl, then it might be likely that you are also able to create more secure Perl scripts than secure PHP scripts, but that doesn't make the language itself more secure. You can do the things you mentioned in PHP as well.
Also, the referring URL can be forged. That information comes from the user itself and can therefore not be relied on for security.
Also, in the shebang line, it's not the path to your "Perl folder" but to the Perl binary. It's an instruction to Unix-like operating systems which interpreter that should be used.