How can I do this? $str =~ s/\d+/&add($1)/gi; doesn't work
s/gi/ge - since i is case insensitive, e is eval ;-) And! capture to get $1:
$str =~ s/(\d+)/&add($1)/ge;
...and &add() is soo perl4...
In reply to Re: String replace with function
by shmem
in thread String replace with function
by kepler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |