in reply to how to evaluate a variable in a string?
This works, but it is certainly not the best way to do it:
$file= '<A NAME="TOC124" HREF="cvs.html#SEC124">A.8 commit--Check file +s into the repository</A>'; $c->{Anchor}{from}='<A NAME="(.*?)" HREF=".*?\#(.*?)">(.*?)</A>'; $c->{Anchor}{to}='$3 |$2| *$1*'; foreach $item (keys %$c) { $from=$c->{$item}{from}; $to=$c->{$item}{to}; eval "\$file=~s/\$from/$to/sg"; } print "$file\n"; # A.8 commit--Check files into the repository |SEC124| *TOC124*
|
|---|