in reply to how to evaluate a variable in a string?

In the line you are doing the assignment:
$c->{Anchor}{to}='$3 |$2| *$1*';
You are using single quotes. If you use double quotes:
$c->{Anchor}{to}="$3 |$2| *$1*";
then it should be properly interpolated. Barring that, you can also use eval (as noted above) to interpolate the string.