For more information... RTFM!

You are not logged in

Powered by Interchange version 5.7.0


Calculates the value of the enclosed (Perl) expression.


  • [calc] Perl expression [/calc]

Parameter Description Default
hide Suppress any output text that would ordinarily be returned from this tag.  (This universal parameter was introduced with Interchange version 5.5.2.) No
interpolate Parse Interchange tags, included in the body text, before this container tag executes. Yes
reparse Process any Interchange tags found in the text output from this tag. Yes


The enclosed region where the arguments are calculated according to normal arithmetic symbols.  For instance:

[calc] 2 + 2 [/calc]

will expand to: 


The [calc] tag is really the same as the [perl] tag, except that it doesn't accept arguments, interpolates enclosed Interchange tags by default and is more efficient to parse.  Interpolation can be turned off by either passing the interpolate=0 parameter, or by simply using the [calcn] tag instead.

The [calc] tag will remember variable values inside the current page, unless scoped with "my", so you can do the equivalent of a memory store and recall for a loop.  Having said that, you must ensure that unscoped variables are initialised to a known value before they are used, as their default value cannot be relied upon.

Object references are available for most Interchange tags and functions, as well as direct references to Interchange session and configuration values.  See Interchange Perl objects for more information.

See also

Categories:  Interchange Perl usage | Interchange tags
Last modified by: Kevin Walsh
Modification date: Wednesday 27 February 2008 at 8:51 AM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us