Path: utzoo!utgpu!cunews!dgbt!netfs.dnd.ca!rutgers!usc!wuarchive!uunet!bfmny0!tneff From: tneff@bfmny0.BFM.COM (Tom Neff) Newsgroups: comp.lang.perl Subject: Re: Printing Numbers with commas in them Keywords: commas formatting Message-ID: <92689365@bfmny0.BFM.COM> Date: 6 Feb 91 20:16:08 GMT References: <389@cti1.UUCP> <1991Feb01.153709.18659@convex.com> Reply-To: tneff@bfmny0.BFM.COM (Tom Neff) Lines: 15 In article <1991Feb01.153709.18659@convex.com> tchrist@convex.COM (Tom Christiansen) writes: >If $_ contains the number (like 12345678.12), this works: > > 1 while s/(.*\d)(\d{3})/$1,$2/; > >Note that with floating point numbers, you might get more >than you bargained for ... I use: 1 while s/(^[^.]*\d)(\d{3})/$1,$2/; -- Cogito ergo spud. I think, O OO O Tom Neff therefore I yam. -- anon O OO OO tneff@bfmny0.BFM.COM