{ no strict 'refs'; ... } # Previous setting resumes after curlies. #### # Name of the function to wrap. my $sub_name = '...'; # Symbol table entry of the function we want to wrap. my $sub_glob = do { no strict 'refs'; \*$sub_name }; # Reference to the function we want to wrap. my $sub = \&$sub_glob; # The wrapper. my $wrapper = sub { ... $sub->(@_) ... }; # Replace function with its wrapper. { no warnings 'redefine'; *$sub_glob = $wrapper; }