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

Yet another way to do it. This is not exactly what you asked, but it may help (tested):

$file= '<A NAME="TOC124" HREF="cvs.html#SEC124">A.8 commit--Check file +s into the repository</A>'; $c->{Anchor}{replace}= sub { $_[0] =~ s{<A NAME="(.*?)" HREF=".*?\#(.*?)">(.*?)</A>} {$3 |$2| *$1*} }; foreach $item (keys %$c) { $c->{$item}{replace}( $file ); } print "$file\n";