Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Integer to Money format

by chrestomanci (Priest)
on Jan 20, 2011 at 09:04 UTC ( #883269=note: print w/ replies, xml ) Need Help??


in reply to Integer to Money format

Was that a homework question? It looks a bit contrived to do it as a regular expression, when there alternative ways of inserting commas every three digits. For example:

join(',', '4123456789' =~ m/.{3}/g )
Comment on Re: Integer to Money format
Download Code
Replies are listed 'Best First'.
Re^2: Integer to Money format
by happy.barney (Pilgrim) on Jan 20, 2011 at 09:27 UTC
    did you mean something like this ? :-)
    scalar reverse join(',', (reverse '4123456789') =~ m/.{1,3}/g);
Re^2: Integer to Money format
by Anonymous Monk on Jan 20, 2011 at 09:34 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2016-04-30 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    :nehw tseb si esrever ni gnitirW







    Results (441 votes). Check out past polls.