You need the /e (for evaluate) option on your substitution, so the function will be called instead of having its name interpolated:
$test =~ s/(\w)(\w+)(\w)/$1 . &garble($2) . $3/eg;
In reply to Re: Executing a function within a regex
by ChemBoy
in thread Executing a function within a regex
by wolis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |