in reply to Executing a function within a regex
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; [download]