The abs method returns the absolute value. In the following example, the method is called on a variable:
my $x = -42; say $x.abs; # 42
To call it on a value, parentheses are needed for negative values. Otherwise, the unary minus operator (see more in Chapter 4, Working with Operators) will be applied to the result of calling the abs method: