in reply to Do regex using hash keys to wrapped template tokens

I can see what you are trying to do. You are replacing all occurrences of parameters present in the hash. How do you handle defaults, i.e. %foo% when foo is not passed in. It would make sense to remove these from the template - but perhaps that is not what you want.

I suggest:

$page_template =~ s/\$(lc_|uc_)(\w+)\$/{ my $tmp = $input->param($2); ($1 eq 'lc')?lc($tmp): ($1 eq 'uc')?uc($tmp):$tmp; }/eg;

Apologies if this is not what you want.

rinceWind