Prev: regex inserting a - for every third digit in a number from right to left
Next: regex inserting a - for every third digit in a number fromright to left
From: J. Gleixner on 16 Jul 2010 15:08 lennie wrote: > Hi group! > > Apologies if this is trvial for you, but I try to construct a s/ / /g that > will insert a - for every third digit in a number from right to left, ie: > 123456 -> 123-456 > 1234567 -> 1-234-567 > 123 -> 123 (no - as first char) > etc.. > > It might be possible to do this with a cpan library function, but I would > like to have this done in a simple sentence. Looks a lot like commify. perldoc -q "How can I output my numbers with commas added" |