Your path to 'perl' was wrong - it should have been
'/usr/bin/perl' and it was set to '/bin/perl'. Executes fine now. I might recommend that you also append
.pl to perl scripts or
.cgi to any cgi script you make, just makes it a little easier to remember what script does what and what language it's in.
BTW, to chmod a globally available script 777 is a big no-no. You should at least use 755, and I recommend 751.
