# Remove leading and trailing whitespace. $str =~ s{\A \* | \s* \z}{}gxm;