in reply to changing a string to a numeric variable

Commas are not valid characters in numbers. You could replace them with underscores (which are valid in perl), but you dont want to change the format. Here is how to compute with them:
use warnings; use strict; my $line = "word 15,000 word word 20,000"; my @line = split /\s+/, $line; my $sum; foreach my $word (@line) { next unless $word =~ /^[\d,.+-]+$/; # crappy number detector $word =~ s/,//g; $sum += $word; } print "$sum\n";

-Mark