webCOMAND

#PERL

Evaluates Perl 5 code. All top-level (aka "in context") cTemplate variables are accessible in the block as Perl variables.  It is similar to the #CALC command, except a block of Perl code can be entered with line breaks, etc.  The last value set will output .

Prototype

#PERL ... #ENDPERL

Return

The value returned by Perl with a return statement, or the last value set.

Example

Here we will insert the contents of a file from a remote website.

#/ Output: FUNKY EXAMPLE
#NEW($var)FuNKy Example#ENDNEW
#PERL
    uc($var);
#ENDPERL

Related

#CSCRIPT, #EVAL, #PHP