Help for this page
$str = "%tag1% went to %tag2% #with $str = ~ s/\%(\S+)\%/$template{$1}/gi;
$str = "%tag1%ALONGSTRINGOFTEXT%tag2% #with ... #would yield: #$str eq $template{"tag1%ALONGSTRINGOFTEXT%tag2"};