in reply to Check exist of anonymous subroutine before calling it within regexp substitute?

If it were my code, I'd probably write it the way moritz has it, but if you're extra paranoid, you might do something like this:

($out_message = $log_format) =~ s{%(.)}{ my $m = $meta_char{$1}; (ref sub {} eq ref $m) ? $m->() : $1 }ge;

That will withstand missing elements as well as elements that exist but don't have a code reference in them.