What is $0?
stands for the first argument in Perl, and is the name of the script file.
unlink $0;
this line at the end in a perl script would remove the script file after its been executed.