Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
while (<DATA>) { $_ =~ s/ #substitute (?<=\d) # find position having 1 number preceeding it (?=(\d\d\d)+(?!\d)) # ant the position have 1 or more groups +of three numbers following it with a non-number at the end /,/ # put a comma at this position g; # do this substitution golbally print "$_"; } __DATA__ 123 1234 12345 123446 1234567 1234567.1234
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comma-fy floats with (+/-)look(aheads/behinds)
by tachyon (Chancellor) on Sep 22, 2003 at 01:55 UTC | |
|
Re: Comma-fy floats with (+/-)look(aheads/behinds)
by Roger (Parson) on Sep 22, 2003 at 04:56 UTC | |
by Anonymous Monk on Sep 22, 2003 at 13:24 UTC | |
|
Re: Comma-fy floats with (+/-)look(aheads/behinds)
by Abigail-II (Bishop) on Sep 22, 2003 at 11:04 UTC | |
|
Re: Comma-fy floats with (+/-)look(aheads/behinds)
by Anonymous Monk on Sep 22, 2003 at 13:04 UTC |