I
inderpaul_s
Here is my code and what I want to do is replace both numbers with
their increments by 1...so I've got the following expression but I can
only get the first number to increment by one: I've written the code to
change the next number further below:
========== this works to increment 32000000 to 32000001============
my $string28 = "There are 32000000 people in Canada, an average of
2600000 per province";
my $string29 = "There are 32000000 people in Canada, an average of
2600000 per province";
if($string29 =~ s/(\d+)/$1 + 1/e)
{
print "\$string28 before is ==> $string28\n";
print "\$string29 after is ==> $string29\n";
}
====== this does NOT work to increment both 3200000 and 2600000 by
1=======
if($string31 =~ s/(\d+)[^\d]+(\d+)/$1+1,$2+1/e)
{
print "\$string30 before is ==> $string30\n";
print "\$string31 after is ==> $string31\n";
}
their increments by 1...so I've got the following expression but I can
only get the first number to increment by one: I've written the code to
change the next number further below:
========== this works to increment 32000000 to 32000001============
my $string28 = "There are 32000000 people in Canada, an average of
2600000 per province";
my $string29 = "There are 32000000 people in Canada, an average of
2600000 per province";
if($string29 =~ s/(\d+)/$1 + 1/e)
{
print "\$string28 before is ==> $string28\n";
print "\$string29 after is ==> $string29\n";
}
====== this does NOT work to increment both 3200000 and 2600000 by
1=======
if($string31 =~ s/(\d+)[^\d]+(\d+)/$1+1,$2+1/e)
{
print "\$string30 before is ==> $string30\n";
print "\$string31 after is ==> $string31\n";
}