[an error occurred while processing this directive]

PERL Expressions

The WebCom form processor supports setting of parameters (variables) using simple perl arithmetic, string, regular expressions and miscellaneous functions as follows:

$variable_name=<PERL expression>;

Arithmetic Expressions

You can calculate the value of a variable using any of the following arithmetic operators: + (addition), - (subtraction), * (multiplication), / (division), % (percentage), ** (exponentiation) (the increment and decrement operators, ++ and --, are not supported). Standard algebraic precedence applies, and can be overridden with parentheses. These operators can be used on literal numeric operands (numbers) as well as on other variables.

You can also use the PERL arithmetic functions:

Examples:

$order_subtotal=$item1_amt + $item2_amt + $item3_amt + $item4_amt;
$order_tax=int($order_subtotal*8.25)/100;

String Expressions

You can use simple PERL string expressions to set parameters/variables to string values. The most basic string expression sets a variable to a literal string (character) value:

$email="myaddress@mydom.com";

Another basic string expression is to concatenate strings together. In PERL expressions, this is done with the . (period) operator:

$screen="www/".$selected_directory."/".$selected_file;

Or, more simply:

$screen="www/$selected_directory/$selected_file";

You can also use the PERL string functions substr and sprintf:

Examples:

$first_initial_and_comma=substr($first_name,0,1).",";
$order_total=sprintf("%8.2f",$order_subtotal+order_tax);

Regular Expressions

You can use regular expression substitutions to change the value of a variable. For example, to change all strings of whitespace to a single space:

$variable =~ s/\s*/ /;

Miscellaneous Functions

You can use the following miscellaneous functions to set values in your form processor application:

Refer to the PERL Home Page for additional resources for learning about about PERL expressions (The Llama book is probably the best resource).

[an error occurred while processing this directive]