Good evening
I don't know this one, and don't know if it's possible. I have a long string, let's say $str; I want to substitute all the pattern occurences (supose /\d+/) by one function with the match as argument. So assume, after each match, that the function is: sub add(){($v) = @_;return ($v*4);}How can I do this?$str =~ s/\d+/&add($1)/gi; doesn't work...and seems terribly wrong...I've placed a simple function, but it can be much more complex.
Regards,Kepler
EDIT: $str =~ s/\d+/&add($1)/ge; works... :)In reply to String replace with function by kepler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |