$x =~s/\.?0+$//;
\. #A literal dot ? #Zero or one of the prevIoUs character 0+ #One or more zeros $ #End of string