John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I'm trying to substitute all comma separated numbers in a texv dile
with the same numbers without commas. This expression will match the
numbers: \d{1,3}?(,\d\d\d)+ but how do i refer to each 3 digit block
after the commas so i can substitute for them? $1 here just returns
the last 3 digit number, but i need to substitute for all of them.
Any help is greatly appreciated.
s/([\d,]+)/(my $x = $1) =~ tr/,//d; $x/eg;
Sorry, that won't work, should be:
s/([\d,]+)/(my $x = $1) =~ tr-,--d; $x/eg;
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/