in reply to Trailing spaces

$string =~ s/ +$//;

Allen