How to call perl or php script from HTML file?

Easiest way to do this is call php/perl script as javascript. Since javascript is client side stuff, php or perl script need to writeback output using javascript commands only. This is useful if you have lots of HTML files and would like to do some server side processing. For example Tips & Tricks section on our site has lots of html pages which uses code as follows:

Above code generates recent post posted in blogs.cyberciti.biz/hm blog. Main advantage of this technique is simple, you can use it from HTML file and your javacode is also hidden (although other better ways exists to do this).

(A) An example of PERL, create file called html.pl as follows and put into your cgi-bin directory:

Add following line to your HTML code (replace mydomain.com with your real domain name):

(B) An example of PHP, create file called html.php as follows and put into your webserver directory:

Add following line to your HTML code (replace mydomain.com with your real domain name):

PHP code is bit easier to use as compare to PERL.