maybe this is a stupid question but :
i run perl 5.8.8 and i need to replace any underscore preceded by a number, with “0”.
running :
$var =~s /(\d)_/$10/g;
obviously does not work as $10 is interpreted as… well… $10, not “$1 followed by 0”
moreover, as runing perl5.8, i can’t do
$var=~s/(?<n1>\d)\_/$+{n1}0/g;
any idea ?
thanks in advance
Just like in various Unix shells, you can enclose the variable name in braces for disambiguation.
Or you can use a look-behind to prevent the digit from being part of the match: