10.4. A Quick Example

Let’s start with a quick example to display “hello, world!” with Embperl (what else?). Create the file /var/www/html/embperl/index.html with the following contents (remember to chmod a+r index.html [3]):

[3] In general, if you have any problems, check your permissions. Don’t make us say this again.

[-
    $msg = ´hello, world!´; 
-] 

<html> 
<head> 
<title>hello, world with Embperl</title> 
</head> 
<body bgcolor="#ffffff"> 
[+ $msg +] 
</body> 
</html> 

To see the result of this page, load one of the following into your browser: http://localhost/embperl/ or www.opensourcewebbook.com/embperl/. You should see something like Figure 10.1.

Figure 10.1. hello, world! with Embperl

The first part of index.html is an Embperl command denoted ...

Get Open Source Web Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.