[EMAIL PROTECTED] wrote:
>
> I'm trying to substitute all comma separated numbers in a text file
> 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.

It's not at all clear what you want to do. What do you want to replace the
commas with? Is a space alright, or do you want to concatenate the fields with
no separator? Are all the fields numeric? If not, then do you want to remove
commas only between numeric fields? If so, then how about

  my $new_record = join ' ', $old_record =~ /(\d+)/g;

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to