in reply to Re: Re: Dividing and format with regular expression the perl way
in thread Dividing and format

Well, just drop trailing dot-star in the regex and see the result. ;-)

I want to get rid of anything after the first decimal point, the tailing (.*) let me do that. Of course I can also rewrite the regular expression as -
$num =~ s/\.(\d)\d+/.$1/; # perform the rounding (as string)
But that requires 3 characters, and I am just too lazy. Besides there is an assumption that whatever passed in is a floating point.

  • Comment on Re: Re: Re: Dividing and format with regular expression the perl way
  • Download Code