Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Splitting every 3 digits?

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


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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-20 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found