The extension of Perl script files can be either .pl or.cgi. However, the file extension depends on the specific role of the script, much like file permissions do:
The.cgi suffix should be used for Perl script files that produce publicly accessible web output.
The.pl extension should be used for Perl scripts that are only intended for command-line execution and for scripts that don't provide web output.