string chop
Returns the argument string without trailing whitespace, including newlines.
Example 1. Chop() example
1 2 $trimmed = chop ($line); 3
See also trim().