There are several different ways to embed Perl code into the Mason pages: <% ... %> sections, “%” lines, and <%perl> ... </%perl> blocks. The next sections explore these.
These tags are useful for generating the values of variables and complex expressions. This example code generates HTML using these tags:
Name: <% $name %> Age: <% $age %> Address: <% %address %> Price : <% $price*(1+$tax)%>
The HTML generated is the result of the evaluation of the variables within the tags, including the evaluation of the final arithmetic expression.
This type of Perl code is most useful for creating global variables and for embedding conditional and looping constructs.
Put this example ...