Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
laziness, impatience, and hubris
 
PerlMonks  

Re: Splitting every 3 digits?

by stefp (Vicar)
on Sep 29, 2001 at 01:34 UTC ( [id://115558]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Splitting every 3 digits?

A related problem that may well be the underlying motivation of the question: writing an integer by block of three digits separated by underscores. The custom is to start from the end because the goal is to make visible thousands, millions and so on. The easy way:
$_=5544443333111; $_=reverse; s/(\d{3})/$1_/g; $_=reverse; s/^_//; print;

-- stefp

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://115558]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.