Is it possible to replace all numbers in a string with a mathematical expression using each number found in the string?
In other words, I have this:
$adjust="1.5";
the string:
$line="The first board's width=\"450\", the second board's width="350", the third board's width=\"550\".";
What I need to do is replace every width number by that number multiplied by $adjust.
ie: (This will never work... ha)
$line =~ s/width=\"(\d+)\"/$_*$adjval/g;
Actually, it is an html page in an array that I would like to change every image width by a percentage. I can do it by spliting each scalar in the array then doing the substitution in a foreach loop. But I would like a one-liner or so to do it. The above is just for example.
Any ideas?
Thanks,
Keith
In other words, I have this:
$adjust="1.5";
the string:
$line="The first board's width=\"450\", the second board's width="350", the third board's width=\"550\".";
What I need to do is replace every width number by that number multiplied by $adjust.
ie: (This will never work... ha)
$line =~ s/width=\"(\d+)\"/$_*$adjval/g;
Actually, it is an html page in an array that I would like to change every image width by a percentage. I can do it by spliting each scalar in the array then doing the substitution in a foreach loop. But I would like a one-liner or so to do it. The above is just for example.
Any ideas?
Thanks,
Keith