1 @# A test program for Temple
2 @# starts with a couple of comments
4 @# The language is very simple -- everything except the "@" character
5 @# gets passed to the output verbatim:
8 @# The "@" starts a control sequence. Arguments of control sequences
9 @# are either everything to the end of the current line (as in case
10 @# of the comment command you are looking at) balanced parenthesized
14 @# If we want to ignore and end of line character, just prefix it by "@":
19 @# If you want to write the "@" character, just write it twice:
22 @# You can embed any perl code in your text:
23 @[foreach $x (1..10) { out "$x "; } ]
25 @# Or if you use @{...}, then the value of the last expression executed
26 @# gets printed automatically:
27 @{"1+2+3 = " . (1+2+3)}
29 @# You can also interpolate perl variables by using @$variable:
32 @# It is possible to call any perl functions
33 @# (any result other than undef will be printed automatically)
34 @# Use `out' to write to the output stream
35 @out("One", "Two", "Three\n")
37 @# Or do the same with parameters running up to the end of the line:
38 @out "Four", "Five", "Six\n"
40 @# There are also some conditionals (you can use any perl expressions):
53 @# Or you can use the parenthesized form:
54 @if(0)ONE@else()TWO@fi()THREE
56 @# To include another file (and possibly change some variables), use:
57 @include("test2", "a" => "HOWDY", "b" => "HULLO", "c" => "AHOY")
58 @include "test2", "a" => "howdy", "b" => "hullo", "c" => "ahoy"
60 @# And to load a perl file:
63 @# This one is tricky: