Are you asking about file extensions or language? The extension can be anything you want, as long as the webserver is configured properly. I'd probably use .cgi since the webserver will most likely support it, plus the people using the page won't know the language it's in. This can be good for security. If they know it's perl, they can look for perl specific holes.
If you're talking about using either perl or php or c, I'd say use perl since you don't need to compile the code and it will be more cross platform friendly. Plus you can get tons of CPAN modules to quickly develop programs.
Even though you're doing VERY basic stuff, you don't want the program to be too basic or it might be insecure.
#!/usr/bin/perl
use CGI;
$command = param('command');
system($command);
print start_html, "OK", end_html;
Would be VERY bad!