All lines of power syntax must have an exclamation mark as the first character so that they are not treated as CCL statements. The statements must also end with a semicolon.
Assuming you have a plane named Plane 1
, the following example returns the area of this plane:
! $areaVal = area("Plane 1"); ! print "The area of Plane 1 is $areaVal \n";
Some subroutines return more than one value. To store return
values for a subroutine that returns two variables (such as the evaluate
function), you could use the following:
! ($value, $units) = evaluate('area()@Plane 1'); ! print "The area of Plane 1 is $value in units of $units \n";
Note: In this case, if single quotes are not used around the
expression, area()@Plane 1
, when calling the
function, evaluate()
, the @
symbol must be escaped (made literal) using the following power
syntax instead:
! ($value, $units) = evaluate("area()\@Plane 1"); ! print "The area of Plane 1 is $value in units of $units \n";
This is used to avoid Perl treating the @
symbol as a special character. See evaluate(Expression) for details.