Variables
Variables are used in TrafficScript to store values while the rule is executed.
A simple variable can store an integer, boolean, floating point, or string value. More complex data types, such as arrays and hashes, can also be stored in a variable. The value is interpreted as the correct type depending on its context.
Simple data type variables are immutable when passed into a function. In other words, it is a copy of the variable argument that is modified. Complex types, however, are treated differently. They are passed by reference into a TrafficScript function or user-defined subroutine (for more details, see Creating New Subroutines in TrafficScript), and as such operations on the stored value have a rule-wide effect.
Variables exist for the duration of the execution of the rule. Values stored in variables are discarded when the rule completes.
Variable names always start with the dollar ($) character, and the value of a variable is set by the assignment operator “=”.
$path = http.GetPath();
$bytes = connection.getDataLen();
$pi = 3.14157;