Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Re: Dividing and format with regular expression the perl way

by Roger (Parson)
on Nov 27, 2003 at 20:42 UTC ( [id://310597]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://310597]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-19 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found